0

I'm currently building a fruit machine emulator that will pay out 'real' money via a hopper. To communicate with the hopper I'm using a hopper interface card that comes with a DLL and instructions on making it work with Delphi, VB6 and VB.NET.

I'm very new to programming but have been learning C++ and successfully programmed some code that works out how much needs to be paid out.

I need to send this info to the hopper and wondered if I can interface to the DLL in C++? (apologies for my naivety if this is a stupid question).

The instructions for opening the COM port (for instance) in VB6 say:

Declaration in Visual Basic 6: Simply add the DLL import unit 'cashdll.bas' to your project, or add following line to the declarations part: Declare Function HOPPER_OPENCOM Lib "CASH.DLL" (ByVal HOPPER_COMPORT As Long) As Long

The cashdll.bas file just has this code:

`'HOPPER-Interface
Declare Function HOPPER_OPENCOM Lib "CASH.DLL" (ByVal HOPPER_COMPORT As Long) As Long
Declare Function HOPPER1_PAYOUT Lib "CASH.DLL" (ByVal HOPPER_COINS As Long) As Long
Declare Function HOPPER1_MOTOR_RUN Lib "CASH.DLL" () As Long
Declare Function HOPPER1_MOTOR_STOP Lib "CASH.DLL" () As Long
Declare Function HOPPER1_READ Lib "CASH.DLL" () As Long
Declare Function HOPPER2_PAYOUT Lib "CASH.DLL" (ByVal HOPPER_COINS As Long) As Long
Declare Function HOPPER2_MOTOR_RUN Lib "CASH.DLL" () As Long
Declare Function HOPPER2_MOTOR_STOP Lib "CASH.DLL" () As Long
Declare Function HOPPER2_READ Lib "CASH.DLL" () As Long
Declare Function HOPPER_IN1 Lib "CASH.DLL" () As Long
Declare Sub HOPPER_CLOSECOM Lib "CASH.DLL" ()`

Would there be an equivalent of this in C++ and, if I wrote that into my Visual Studio project and somehow 'included' the DLL would it still operate?

Thanks

(The hopper interface page with more details is here)

John T
  • 1,078
  • 3
  • 14
  • 29
  • 2
    I hope all these dupe links are exhaustive enough to answer your question. – πάντα ῥεῖ Jun 10 '17 at 10:06
  • @πάνταῥεῖ Thanks for the links. Unfortunately I'm struggling to apply them to my own issue here. The first link you posted is the most relevant but the way the question is asked suggests someone with much more knowledge than me and the answers follow that pattern. In order to answer this question for me I really need more elucidation around my specific issue if possible? Thanks :) – John T Jun 10 '17 at 10:17
  • Well, I believe giving you that information and closing your question as duplicate, is much better than letting it be closed as _too broad_. – πάντα ῥεῖ Jun 10 '17 at 10:20
  • 2
    _"with a site that is supposed to help people"_ That's a common misconception. The site isn't here to help people in 1st place, but meant as a FAQ like repository, to help for general research. – πάντα ῥεῖ Jun 10 '17 at 10:30
  • 1
    There are countless resources out there. Do some research, and make an effort to call this DLL. Write some code, following on of the many tutorials. And as for, SO, we are not here to help individuals with their specific problem. We are here a Q&A site making general resources. If you can get help along the way, by fitting in with our template, great. If not you'll need to look elsewhere. – David Heffernan Jun 10 '17 at 10:31
  • 1
    @πάνταῥεῖ and David Yep. Now that I think about it. You are both perfectly correct. I think it's just because I'm really in a rush to get this working and I admit that I haven't done anything like the due diligence I should have done before posting something on here. I retract my earlier comments. Leave it with me and I'll do some more reading over the next week and (hopefully) come up with some code that works. If not, at least I'll have some code to post in order to get help on. Thanks :-) – John T Jun 10 '17 at 10:38
  • 1
    This really could not be easier, fortunately for you. The functions are all `__stdcall`, and all args/return values are simply `int`. – David Heffernan Jun 10 '17 at 10:52
  • @DavidHeffernan Thank you for the heads up :-) – John T Jun 10 '17 at 18:27

0 Answers0