>> Witch is the way to intercept events fired by AutoCAD?
It depends on how AutoCAD event model. I asked you to attach AutoCAD_TLB file to watch how exactly ACAD defines its events.
For example if your AutoCAD_TLB looks like this:
TAcadDocumentBeginSave = procedure(ASender: TObject; const FileName: WideString) of object;
...
TAcadDocument = class(TOleServer)
....
property OnBeginSave: TAcadDocumentBeginSave read FOnBeginSave write FOnBeginSave;
property OnEndSave: TAcadDocumentEndSave read FOnEndSave write FOnEndSave;
property OnBeginCommand: TAcadDocumentBeginCommand read FOnBeginCommand write FOnBeginCommand;
property OnEndCommand: TAcadDocumentEndCommand read FOnEndCommand write FOnEndCommand;
...
When you can do something like this:
type
TForm1 = class(TForm)
...
private
procedure HandlerForAcadDocBeginSave(ASender: TObject; const FileName: WideString);
...
procedure TForm1.Button1Click(ASender:TObject);
var
Acad: IAcadApplication;
AcadDocument: TAcadDocument;
begin
Acad := CreateOleObject('AutoCAD.Application')as IAcadApplication;
Acad.Visible := true;
AcadDocument:=TAcadDocument.Create(Application);
AcadDocument.OnBeginSave:= HandlerForAcadDocBeginSave;
AcadDocument.ConnectTo(Acad.ActiveDocument);
...