S
SonicX
Unregistered / Unconfirmed
GUEST, unregistred user!
我定义了一这样的线程
TMyThread=Class(TThread)
protected
procedure Execute;
override;
public
constructor Create;
procedure GameDebug(pKey:array of Byte;
pMouse:TDIMouseState2;
pJoy:TDIJoyState2);
end;
constructor TMyThread.Create;
begin
inherited Create(False);
end;
procedure TMyThread.Execute;
var
KeyNow :array[0..255] Of Byte;
//DirectInputKey
MouseState :TDIMouseState2;
//DirectInputMouse
JoyState :TDIJoyState2;
//DirectInputJoy
begin
While not Terminateddo
begin
//...
//利用DirectInput取得输入信息,略...
//...
//...一些处理
Debug(KeyNow, MouseState, JoyState);
//运行到这里出错
//...
//...一些处理
end;
end;
procedure TMyThread.Debug(pKey:array of Byte;
pMouse:TDIMouseState2;
pJoy:TDIJoyState2);
begin
//....
//记录这类信息
//....
end;
运行到Debug(KeyNow, MouseState, JoyState);
有时出错有时又正常
我想使用Synchronize,又通不过编译,请行家帮忙看看该如何修改
TMyThread=Class(TThread)
protected
procedure Execute;
override;
public
constructor Create;
procedure GameDebug(pKey:array of Byte;
pMouse:TDIMouseState2;
pJoy:TDIJoyState2);
end;
constructor TMyThread.Create;
begin
inherited Create(False);
end;
procedure TMyThread.Execute;
var
KeyNow :array[0..255] Of Byte;
//DirectInputKey
MouseState :TDIMouseState2;
//DirectInputMouse
JoyState :TDIJoyState2;
//DirectInputJoy
begin
While not Terminateddo
begin
//...
//利用DirectInput取得输入信息,略...
//...
//...一些处理
Debug(KeyNow, MouseState, JoyState);
//运行到这里出错
//...
//...一些处理
end;
end;
procedure TMyThread.Debug(pKey:array of Byte;
pMouse:TDIMouseState2;
pJoy:TDIJoyState2);
begin
//....
//记录这类信息
//....
end;
运行到Debug(KeyNow, MouseState, JoyState);
有时出错有时又正常
我想使用Synchronize,又通不过编译,请行家帮忙看看该如何修改