link DLL

peggypph

Registered User.
Local time
Today, 22:13
Joined
Jan 2, 2004
Messages
33
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
 
peggypph said:
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:
 
Mile-O-Phile said:
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
 
Mile-O-Phile said:
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!
 

Users who are viewing this thread

Back
Top Bottom