2010-12-07 56 views
0
uint x = 0x00000001; 
uint y = 0x00FF00FD; 
NativeMethods.PostMessage(hwnd, NativeMethods.WM_LBUTTONDOWN, x, y); 
NativeMethods.PostMessage(hwnd, NativeMethods.WM_LBUTTONUP, x, y); 

使用上述語句,我可以點擊外部窗口應用程序上的選定區域。現在,我需要發送一個ctrla + ctrlc到窗口。Win32 API - Ctrl A + Ctrl C

你能告訴我如何使用Win32 API來做到這一點。

回答

1

發送一個WM_GETTEXT以獲得窗口中的實際文字,你不會更好地服務嗎?依靠鼠標/鍵盤仿真的應用程序最好是脆弱的。

+0

NativeMethods.AttachThreadInput(processId,currentThreadId,true); int focussed = NativeMethods.GetFocus(); StringBuilder builder = new StringBuilder(500); NativeMethods.SendMessage(focussed,WM_GETTEXT,builder.Capacity,builder); – Gooose 2010-12-07 04:34:53