Set WodSFTP Event Handlers programmatically in Del - WeOnlyDo Discussion board

Set WodSFTP Event Handlers programmatically in Del (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Ian McGregor, Monday, February 26, 2007, 13:22 (6481 days ago)

I am trying to set the WodSFTP event handlers programmatically, in a unit that does have the object attached to a form.

Thus I have a unit that looks something like

unit untWoD;
interface
implementation
uses wodSFTPCOMLib_TLB, ,,,,,,;
var
WodSFTPComX: TwodSFTPCOM;

procedure MyComConnected(Sender: TObject; ErrorCode: Smallint;
var ErrorText: OleVariant);
begin
CheckErrorCode(ErrorCode, ErrorText)
end;

How do I set the WodSFTPComX.OnConnected event handler to point to my handler MyComConnected ?

I would be grateful if you could send me a short Delphi code stub that shows how to do it. I have got it working on a form with the IDE setting the Event procedures, but I want to create a self-contained unit that is independent of the IDE.

Re: Set WodSFTP Event Handlers programmatically in

by wodDamir, Monday, February 26, 2007, 15:33 (6480 days ago) @ Ian McGregor

Hi Ian,

I'm not sure how much i'll be able to help you as i'm not really a Delphi guru, but i believe the idea is to declare a function which would handle the Event.

Something like this:
------------------------------------------
WodSFTPComX.OnConnected := MyComConnected;
------------------------------------------

This should be done for each event you want to use.

Regards,
Damba