Trying to set up a USB power strip.
Here\'s the documentation:
Initializes the Power USB API.
Name: InitPowerUSB
Parameters: model:returns the mod
I can't answer the rest of your function signature woes since I don't have any documentation for your PwrUSBDll.dll
.
However "Bad DLL calling convention" errors generally mean you have a CDecl
entrypoint and VB6 can only call those with some help.
There are a couple of fixes.
The obvious one is to modifiy the source and recompile that DLL using StdCall
instead.
Another is to create a type library for that DLL, which helps inform VB6 about the issue and resolves it.
Then you have the option of using VB6's undocumented CDecl decorator:
Public Declare Function InitPowerUSB CDecl Lib "PwrUSBDll.dll" ( _
ByRef model As Integer, _
ByVal firmware As String) As Integer
However the downside is that this will not work when run within the IDE, nor will it work when compiled to p-code. The p-code interpreter doesn't process this keyword.
So you could just bypass it in IDE runs and supply dummy results for testing, or you can create a small wrapper DLL in VB6 that you separately compile to native code.
Caveats:
For this to solve your problem we'd have to assume you are passing correct data types in that argument list. A C++ int
is a VB6 Long
. You are probably better off passing a VB6 Byte
array ByRef
for that char[8]
unless this is a Unicode DLL entrypoint. The function return value is also most likely Long
.