how can i handle the event Quit from Word in Delphi code?
i would like to do the same like this, but in delphi
i’ve got the same problem of the linked post
my code is like :
type
TMSOAWinWord97 = class(...)
private
FApplication : OleVariant;
protected
procedure WordAppQuit(Sender: TObject);
public
...
end;
procedure TMSOAWinWord97.WordAppQuit(Sender: TObject);
begin
FApplication := unassigned;
end;
procedure TMSOAWinWord97.CreateApplication(showApplication: Boolean);
begin
FApplication:=CreateOleObject('Word.Application.12');
FApplication.Quit := WordAppQuit;
...
end;
make a unit UEventsSink
in main program add an object eventSink and a method for your Exit function, connect the object EventSink to the ole variant of the Word application and register the function for exit