Bill,
I am stuck because I can't access the dll from vb6, I know that the answer is simple:
Here is the VB6 code I am testing:
PHP Code:
Public Declare Function MPUSBGetDeviceCount Lib "mpusbapi.dll" Alias "_MPUSBGetDeviceCount" (ByVal pVID_PID As String) As Long
Global count As Long
Sub OpenMPUSBDevice()
count = MPUSBGetDeviceCount("vid_04d8&pid_003f" & Null) ''ERROR here with Error 49 Bad DLL calling convention
End Sub
Here is what I believe is the C code from the source files for mpusbapi.dll:
PHP Code:
DWORD MPUSBGetDeviceCount(PCHAR pVID_PID)
{
DWORD count; // Number of USB device with matching VID & PID
count = 0; // Initialization
for(int i = 0; i < MAX_NUM_MPUSB_DEV; i++)
{
if(MPUSBGetDeviceLink(i,pVID_PID,NULL,NULL,NULL) == MPUSB_SUCCESS)
count++;
}//end for
return count;
}//end MPUSBGetDeviceCount
The DLL routine returns a DWORD which I think is VB6 Long and the argument is PCHAR which I think is a Null terminated string so I added the Null in calling it.
I've tried it many different ways with no luck-- always ' Error 49 Bad DLL calling convention'.
Have you got any thoughts on this?
I have attached the Dll if you want to quickly try this.
Thanks,
Dale