Hello.
I have a "test.dll" and it declares functions in cdecl. Knowing that vbRichClient5 can call these functions, I tried to call some functions and it succeeded.
However, there's a function I can't do so. Here's the code in a header:
And in VB6, I wrote like this:
It returns "Invalid argument". But I tried in another language with the same arguments and it succeeded. Can anyone figure out what goes wrong?
Thanks.
I have a "test.dll" and it declares functions in cdecl. Knowing that vbRichClient5 can call these functions, I tried to call some functions and it succeeded.
However, there's a function I can't do so. Here's the code in a header:
Code:
__cdecl __declspec(dllimport) int16_t fileput(void *handle, const char *localpath, const char *remotepath);
Code:
Public Function FilePut(ByVal Handle as Long, ByVal LocalPath as String, ByVal RemotePath as String) as Integer
'libHandle = LoadLibrary("test.dll")
'Set Con as New cConstructor
Dim pFunc as Long
pFunc = GetProcAddress(libHandle, "fileput")
Debug.Assert pFunc
Dim ret as Integer
Dim tmpLocalPath as String * 255, tmpRemotePath as String * 255
tmpLocalPath = StrConv(LocalPath, vbFromUnicode)
tmpRemotePath = StrConv(RemotePath, vbFromUnicode)
ret = Con.cdeclCall(retInteger, pFunc, Handle, tmpLocalPath, tmpRemotePath)
Debug.Assert ret >= 0
FilePut = ret
End Function
Thanks.