I have problems implementing SFTP with VB6 and ActiveX-Exe.

In the IDE everthing works fine, but as soon I try it with the compiled Exe it crashes at the Connect method of SFTPConnection:
If objSFTP.Connect = sfFTPLib.enumError.ftpErrorSuccess Then

Any ideas?

For FTP I have used the FTPConnectionSTA class:
(Use this class only if your environment doesn't support multiple threads. e.g. VB6, VBScript, JavaScript. In all other cases use the FTPConnectionMTA class instead.)

Is there also a STA class for SFTP?

Thanks in advance!

BR Markus

Hello Markus ..

There is no STA class for the SFTPConnection object. It seems in the release build VB6 cannot handle events that come from another thread. You can try to remove all event handlers for the SFTPConnection if you have any. This is the way VBScript/Javascript works when using the SFTPConnection class.


I have tried your sample project. As soon it is compiled with "WithEvents" it crashes ...
That means that with VB6 it's not possible to have a status information about transfer progress??

Because you can't show an user an up-/download without a progressbar ...

Isn't there a way to solve this?


Yes that's correct. Events do not work in VB6. My recommendation is to convert your project to VB.NET if possible.