| 发表于:2007-01-05 10:42:567楼 得分:0 |
我模拟了下,你可以参照: class api_func { [dllimport( "user32.dll ")] public static extern intptr findwindow(string lpclassname, string lpwindowname); [dllimport( "user32.dll ")] public static extern intptr findwindowex(intptr hwndparent, intptr hwndchildafter, string lpszclass, string lpszwindow); [dllimport( "user32.dll ")] public static extern bool postmessage(intptr hwnd, uint msg, int wparam, int lparam); } private void button2_click(object sender, eventargs e) { intptr hwnd = api_func.findwindow(null, "form1 "); if (hwnd != null) { intptr hbutton = api_func.findwindowex(hwnd, (intptr)null, null, "yes "); if (hbutton == null) return; api_func.postmessage(hbutton, wm_lbuttondown, mk_lbutton, 0x000b0024); api_func.postmessage(hbutton, wm_lbuttonup, mk_lbutton, 0x000b0024); } } | | |
|