得到窗口并发送消息

var wh:hwnd;begin wh:=findWindow(nil,'追影虚拟多桌面'); //把记事本窗口激活 SetForegroundWindow(wh); //设置当前窗口为活动窗口 keybd_event(VK_CONTROL,0,KEYEVENTF_EXTENDEDKEY or 0,0); keybd_event(76,0,KEYEVENTF_EXTENDEDKEY or 0,0); sleep(1000); keybd_event(76,0,KEYEVENTF_EXTENDEDKEY ...

键位对应的值

常数名称 十六进制值 十进制值 对应按键VK_LBUTTON 01 1 鼠标的左键VK_RBUTTON 02 2 鼠标的右键VK-CANCEL 03 3 Contol-break 执行VK_MBUTTON 04 4 鼠标的中键(三按键鼠标)VK_BACK 08 8 Backspace键VK_TAB 09 9 Tab键VK_CLEAR 0C 12 Clear键VK_RETURN 0D 13 Enter键VK_SHIFT 10 16 Shift键VK_CONTROL 11 17 Ctrl键VK_MENU 12 18 Alt键VK_PAUSE 13 19 Pause键VK_CAPITAL 14...

小技巧

每个键位对应的数值showmessage(pchar(intTostr(Integer(Key))));--------------------------------------------------------------SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); //程序不在任务栏显示
编程点滴 | 2010-03-07 02:44 | 阅读 99395 次 | 评论 0 条

关闭进程和模拟键盘输入

program Project1;uses Windows,SysUtils,Tlhelp32;{$R *.res}function FindProcessId(ExeFileName: string):THandle;varContinueLoop:BOOL;FSnapshotHandle:THandle;FProcessEntry32:TProcessEntry32;beginresult:=0;FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);FProcessEntry32.dwSize:=Sizeof...
浏览2354300次