Hi,
If I have an object of type TMyType, which publishes an event StateChanged, how do I hook up to that event?
Now the rub comes from the fact that TMyType is a class from .NET, exposed through COM interop. But that's another question - first I need to know how to register with TMyType's event(s). If it's useful to know this - the event is defined as a method in a COM interface IApplicationPublisher, which derives from IUnknown.
Thanks in advance for any help!
If I have an object of type TMyType, which publishes an event StateChanged, how do I hook up to that event?
Code:
unit InteropSample;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses vlibwin32_TLB;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
mockDashboard: TMyType;
text: WideString;
begin
mockDashboard := TMyType.Create();
// how do i connect to mockDashboard's StateChange event?
end;
end.
Now the rub comes from the fact that TMyType is a class from .NET, exposed through COM interop. But that's another question - first I need to know how to register with TMyType's event(s). If it's useful to know this - the event is defined as a method in a COM interface IApplicationPublisher, which derives from IUnknown.
Thanks in advance for any help!