模拟键盘事件 源码分析 为什么 只模拟一次 也后就无效了
rokyo 2002-12-25 10:09:58 具体源码
void __fastcall TForm1::Timer2Timer(TObject *Sender)
{ String nBlue,nTE;
nBlue=(Form1->Edit2->Text);
HWND WndHandle;
unsigned long lBase;
unsigned long pId;
unsigned char pBuffer[240];
DWord nRead;
nRead=2;
lBase=0x03194F24;
HANDLE hProcess;
WndHandle = FindWindow(NULL,"欢迎您来到N-age世界");
GetWindowThreadProcessId(WndHandle,&pId);
hProcess=OpenProcess(PROCESS_ALL_ACCESS, False,pId);
ReadProcessMemory(hProcess,(LPCVOID)lBase,pBuffer,1,&nRead);
Edit1->Text=pBuffer[0];
nTE=(Form1->Edit1->Text);
CloseHandle(hProcess);
if (nTE<nBlue)
keybd_event(49,0,0,0);
}
我再游戏中想当生命小了以后键盘自动按下1 吃药 什么只能用一次 就无效了只有重新打开 才能再有效一次