A
antdown
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,MMSystem;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TTest=class
private
dwTestWORD;
procedure CallBackTest(uTimerID, uMessage: UINT;
dwUser, dw1, dw2: DWORD) stdcall;
public
procedure Myproc;
end;
var
Form1: TForm1;
Test:TTest;
implementation
{$R *.dfm}
{ TTest }
procedure TForm1.Button1Click(Sender: TObject);
begin
Test:=TTest.Create;
Test.Myproc;
timeSetEvent(1000,1,@TTest.CallBackTest,1,1);
end;
procedure TTest.Myproc;
begin
dwTest:=1;
end;
procedure TTest.CallBackTest(uTimerID, uMessage: UINT; dwUser, dw1,dw2: DWORD);
begin
uTimerID:=dwTest;
OutputDebugString(PChar(IntToStr(uTimerID))); // 此行出错,虽然同在类内,但经过CALLBACK后,肯定发生了某些变化,请问如何读写dwTest
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Test.Free;
end;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,MMSystem;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TTest=class
private
dwTestWORD;
procedure CallBackTest(uTimerID, uMessage: UINT;
dwUser, dw1, dw2: DWORD) stdcall;
public
procedure Myproc;
end;
var
Form1: TForm1;
Test:TTest;
implementation
{$R *.dfm}
{ TTest }
procedure TForm1.Button1Click(Sender: TObject);
begin
Test:=TTest.Create;
Test.Myproc;
timeSetEvent(1000,1,@TTest.CallBackTest,1,1);
end;
procedure TTest.Myproc;
begin
dwTest:=1;
end;
procedure TTest.CallBackTest(uTimerID, uMessage: UINT; dwUser, dw1,dw2: DWORD);
begin
uTimerID:=dwTest;
OutputDebugString(PChar(IntToStr(uTimerID))); // 此行出错,虽然同在类内,但经过CALLBACK后,肯定发生了某些变化,请问如何读写dwTest
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Test.Free;
end;