Calling SFTPDLL.DLL Sftp_Create from VB6 - WeOnlyDo Discussion board

Calling SFTPDLL.DLL Sftp_Create from VB6 (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Pete Sheldrake, Friday, November 18, 2005, 09:36 (6945 days ago)

Hi,
I have a need to call Sftp_Create declared in sftpdll.dll from vb. i do alot of API programming in VB for a number of legacy systems at my place of work, but i don't seem to be able to workout how to convert the structure of the method call to vb...

so far i have the following for SftpEventsStruct:

Type SftpEventsStruct
Connected As Long
Disconnected As Long
StateChange As Long
HostFingerprint As Long
Progress As Long
ListItems As Long
Done As Long
Attributes As Long
CryptoInformation As Long
AttributesData As Long
LoginChallenge As Long
LoopItem As Long
LoopError As Long
End Type

and the followign for the method declaration:

Declare Function Create Lib sftpdll.dll Alias Sftp_Create (Events As SftpEventsStruct, key As Long) As Long

The problem is that when i call the above method with the following code:

Dim events As SftpEventsStruct, lhandle As Long
Dim s As String: s =
Dim lptr As Long: lptr = VarPtr(s)
lhandle = Create(events, lptr)

i get the classic 'something isn't correct in the parameters' error of 'Runtime error 49, bad dll calling convention'.

hopefully i'm being dim and have missed something obvious. !!!


Complete thread: