Я думаю, что Stackoverflow более активен и агрессивен, чем форум Embarcadero. Я получаю больше ответов здесь.
ользую Delphi XE IDE. Я создаю уведомитель для реализации IOTACompileNotifier. После установки эксперта в IDE. Код работает нормально, когда я компилирую свой проект. Уведомитель работает для ProjectCompileStarted.
Во второй раз, когда я компилирую свой проект, приглашение Delphi IDE:
[Fatal Error] Access violation at address 21B7FBED in module 'delphicoreide150.bpl'. Read of address 00000000
Хотя кажется странным, что я выполняю:
var i: integer;
begin
i := Project.ProjectBuilder.AddCompileNotifier(TProjectCompileNotifier.Create);
Project.ProjectBuilder.RemoveCompileNotifier(i);
end;
в уведомлении. Я просто хочу показать, что Add and Remove компилятор уведомлений для ProjectBuilder не работает должным образом, независимо от того, как я использую
Посоветуйте, пожалуйста, как мне реализовать IOTAProjectCompileNotifier.
Спасибо.
Вот полный исходный код:
type
TProjectCompileNotifier = class(TInterfacedObject, IOTAProjectCompileNotifier)
protected
procedure AfterCompile(var CompileInfo: TOTAProjectCompileInfo);
procedure BeforeCompile(var CompileInfo: TOTAProjectCompileInfo);
procedure Destroyed;
end;
TCompileNotifier = class(TInterfacedObject, IOTACompileNotifier)
protected
procedure ProjectCompileStarted(const Project: IOTAProject; Mode: TOTACompileMode);
procedure ProjectCompileFinished(const Project: IOTAProject; Result: TOTACompileResult);
procedure ProjectGroupCompileStarted(Mode: TOTACompileMode);
procedure ProjectGroupCompileFinished(Result: TOTACompileResult);
end;
procedure TCompileNotifier.ProjectCompileStarted(const Project: IOTAProject;
Mode: TOTACompileMode);
var i: integer;
begin
i := Project.ProjectBuilder.AddCompileNotifier(TProjectCompileNotifier.Create);
Project.ProjectBuilder.RemoveCompileNotifier(i);
end;
var i: integer;
initialization
i := (BorlandIDEServices as IOTACompileServices).AddNotifier(TCompileNotifier.Create);
finalization
(BorlandIDEServices as IOTACompileServices).RemoveNotifier(i);
end.