| 发表于:2007-09-21 17:28:054楼 得分:60 |
给你个例子 [dllimport( "user32.dll ")] public static extern int sendmessage(intptr hwnd, uint msg, int wparam, string lparam); [dllimport( "user32.dll ")] public static extern intptr findwindowex(intptr hwndparent, intptr hwndchildafter, string lpszclass, string lpszwindow); public const uint wm_settext = 0x000c; private void button1_click(object sender, eventargs e) { process vprocess = process.start( "notepad.exe "); while (vprocess.mainwindowhandle == intptr.zero) vprocess.refresh(); intptr vhandle = findwindowex(vprocess.mainwindowhandle, intptr.zero, "edit ", null); sendmessage(vhandle, wm_settext, 0, "zswang 路过 "); } | | |
|