能力值:
( LV13,RANK:410 )
|
-
-
2 楼
int main()
{
HWND notepad_h=FindWindow("Notepad",NULL);
if(notepad_h)
{
SetForegroundWindow(notepad_h); //这行不是必需的.
SendMessage(notepad_h,WM_KEYDOWN,VK_ALT,0);
SendMessage(notepad_h,WM_DOWN,VK_F,0);
SendMessage(notepad_h,WM_UP,VK_F,0);
SendMessage(notepad_h,WM_DOWN,VK_A,0);
SendMessage(notepad_h,WM_UP,VK_A,0);
SendMessage(notepad_h,WM_KEYDOWN,VK_ALT,0);
}
}
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
窗口句柄应该是那个编辑框吧
|
能力值:
( LV7,RANK:110 )
|
-
-
4 楼
不是发送消息到记事本主窗口句柄,是获取记事本edit句柄,或者直接模拟按键盘:)
keybd_event(VK_MENU,0,0,0);
keybd_event(70,0,0,0);
|
能力值:
( LV2,RANK:10 )
|
-
-
5 楼
试试这个
int main(void)
{
HWND notepad_h=FindWindow(NULL,"无标题 - 记事本");
if(notepad_h)
{
SendMessage(notepad_h,WM_COMMAND,WPARAM(0x00000004),0);
}
return 0;
}
|
能力值:
( LV4,RANK:50 )
|
-
-
6 楼
delphi的一段代码:
procedure SwitchToThisWindow( hWnd: HWND;
fAltTab: BOOL
); stdcall; external 'user32.dll';
var
notepad_h,c: Cardinal;
begin
notepad_h:=FindWindow('Notepad',0);
asm
mov c, 10100000000000000000000000000001b
end;
c := ((MapVirtualKey(Integer('F'), 0) and $ff) shl 16) or c;
SwitchToThisWindow(notepad_h, True);
PostMessage(notepad_h,WM_SYSCHAR,Integer('F'),c);
asm
mov c, 10000000000000000000000000000001b
end;
SwitchToThisWindow(notepad_h, True);
c := ((MapVirtualKey(Integer('A'), 0) and $ff) shl 16) or c;
PostMessage(notepad_h,WM_CHAR,Integer('A'),c);
end;
|
|
|