关键问题是如何取得到你要更改的窗口句柄.//changes the text of the specified window's title bar (if it has one). //If the specified window is a control, the text of the control is changed. //However, SetWindowText cannot change the text of a control in another application. [DllImport("user32.dll")] public static extern bool SetWindowText( int hWnd, // handle to window or control System.Text.StringBuilder lpString // title or text );
int handle =yourwinhandle System.Text.StringBuilder buff=new System.Text.StringBuilder("Set Window Text with win32 api"); SetWindowText(handle,buff);
试了,不能捕获另一个应用程序。
//If the specified window is a control, the text of the control is changed.
//However, SetWindowText cannot change the text of a control in another application.
[DllImport("user32.dll")]
public static extern bool SetWindowText(
int hWnd, // handle to window or control
System.Text.StringBuilder lpString // title or text
);
int handle =yourwinhandle
System.Text.StringBuilder buff=new System.Text.StringBuilder("Set Window Text with win32 api");
SetWindowText(handle,buff);