我正在尝试在一些 Delphi 项目中构建自己的类。代码是这样的:
type
TMyClass = class(TObject)
private
hwnMain, hwnChild: HWND;
Buffer, URL: string;
Timer: TTimer;
public
procedure ScanForClass;
end;
var
Form1: TForm1;
TimerAccess: TMyClass;
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
TimerAccess.ScanForClass;
end;
procedure TMyClass.ScanForClass;
begin
Timer:= TTimer.Create(Application); **here I get Access Violation!!**
Timer.Interval:= 5000;
Timer.Enabled:= true;
为什么会出现访问冲突?