how can I get a disconnect event like "sftp.OnAbortCheck := sftpAbortCheck;" in ActiveX, please.
I'm using Delphi non-Active-X Version and can't find out how to catch events in that version. (sry, I'm new with that)
asked Aug 17 '16 at 13:14
Unfortunately, event callbacks don't exist in the non-ActiveX Delphi DLL. I don't know of a way (yet?) to call back from native C++ into a Delphi app. I would imagine there's a way to do it since the ActiveX COM infrastructure provides that ability.
Thus, at this time, there are two Delphi options: (1) The ActiveX w/ event callbacks, but the drawback is that the ActiveX DLL needs to be registered (regsvr32) on any computer where it runs, or (2) The Delphi DLL which needs no regsvr32 registration, but has no callbacks.
answered Aug 18 '16 at 08:43
callbacks from C++ to delphi can be done as in following example. in the example there is also a "tag"-param, which allows in the delphi-code the reentrance into the object (from __callback_Register_OnClose into TForm213.Nfy_OnClose).
hope this helps. if I can help more, please do not hesitate to contact me directly.
------------------------------ c++ code:
//type-definition for callback func
extern "C" typedef void ( TFktRegisterOnClose)( void * a__tag, int handle, char a_value);
//function to register callback
extern "C" __declspec(dllexport)void Register_OnClose( TFkt_Register_OnClose a_fkt, void * a_callback_tag);
extern "C" __declspec(dllexport)void DoTest( int v1, int v2);
//global defined variables - here for Demonstration
TFkt_Register_OnClose glob_fkt = (TFkt_Register_OnClose)0;
void * glob_callback_tag = (void *) 0;
void Register_OnClose( TFkt_Register_OnClose a_fkt, void * a_callback_tag)
void DoTest( int v1,int v2)
// now doing the callback
-------------------------------- Delphi-code: unit Unit213;
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;
type TForm213 = class(TForm)
var Form213: TForm213;
const DLLName= 'C:\projectstst_dlldebugtst_dll.dll';
type TFkt_Register_OnClose= procedure( a_tag:Pointer; handle:Integer; a_value:PAnsiChar); cdecl;
answered Aug 18 '16 at 11:47
Thanks! I'll see what can be done, but I can't promise anything at the moment..
answered Aug 19 '16 at 09:41