[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr Hwnd, int Msg, int wpala, string lpala);
我用findwindowex已经找到记事本文本的窗口句柄,发送char类型的英文已经实现,但是怎么发送中文啊?
用string类型为啥没反应额..查了下网上说要用SendMessage+WM_SETTEXT,请问给下代码怎么具体操作的,感激不敬...
public static extern int SendMessage(IntPtr Hwnd, int Msg, int wpala, string lpala);
我用findwindowex已经找到记事本文本的窗口句柄,发送char类型的英文已经实现,但是怎么发送中文啊?
用string类型为啥没反应额..查了下网上说要用SendMessage+WM_SETTEXT,请问给下代码怎么具体操作的,感激不敬...
向活动应用程序发送击键。下面是一个示例: // Clicking Button1 causes a message box to appear.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
MessageBox.Show("Click here!");
} //窗体上只有一个按钮时,默认加载后,button1处于焦点状态,所以下面会触发Button1_Click
private void Form1_DoubleClick(object sender, System.EventArgs e)
{ // Send the enter key; since the tab stop of Button1 is 0, this
// will trigger the click event.
SendKeys.Send("{ENTER}");
}
发送 wm_settext 而不是 wm_char
[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr Hwnd, int Msg, string wpala, int lpala);
SendMessage(ChildWnd, WM_GETTEXT,"asdasdasda", 0);
ChildWnd已经取到,但是这样还是发不出去的
[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr Hwnd, int Msg, string wpala, int lpala);
SendMessage(ChildWnd, WM_SETTEXT, "asdasdasda", 0);
这样还是不行....
An application sends a WM_SETTEXT message to set the text of a window. Parameters
wParam
This parameter is not used. lParam
Pointer to a null-terminated string that is the window text. 是lParam为字符串。