View Full Version : link DLL


peggypph
07-21-2004, 11:01 PM
I got a third-party DLL which I need to assess the device through Access programming. As far as the document i got, that DLL is developed in VC++.

Handle PASCAL OpenCommPort(LPCSTR lpszportnum, Dword dwBaudRate)
VOID PASCAL CLoseCommPort(HANDLE hCom)


In my Access VB, I declare this DLL by Declare Function

Declare Function OpenCommPort Lib "c:\library\JS168Comm.dll" (ByVal Parm1, ByVal Parm2 As Integer) As OLE_HANDLE

Declare Function CloseCommPort Lib "c:\library\JS168Comm.dll" (ByVal Parm1 As Variant)

It doesn't work. I think I got problem on data type declaration of Parm1, parm2 corresponding to the original document specified under VC++.

Who has idea what data type I should correspond the data type "Handle", "LPCSTR", "DWord"? Or advise me how to set the declare function under VB so that I can make use of this DLL?

Thanks

Regards,
Peggy Poon

Mile-O
07-22-2004, 01:42 AM
Who has idea what data type I should correspond the data type "Handle", "LPCSTR", "DWord"? Or advise me how to set the declare function under VB so that I can make use of this DLL?


I'd guess at Long, Long, and String respectively - no idea though. :confused:

peggypph
07-22-2004, 02:33 AM
I'd guess at Long, Long, and String respectively - no idea though. :confused:

As I know LPCSTR is the pointer data type in VC++ and I have to pass COM port no. (say 1 or 2), what is the corresponding syntax/data type I can use to pass in my function declaration of OpenCommPort

peggypph
07-22-2004, 08:24 PM
I'd guess at Long, Long, and String respectively - no idea though. :confused:

Finally, it works by assigning Long, String, Long respectively (Handle, LPCSTR, DWORD). Thanks a lot!