我正在使用FindWindowEx和SendMessage通过我的c#程序将消息发送到KakaoTalk。我设法发送了一条消息,但如果我用韩文输入,则该短语完全崩溃。这是我下面的代码,所以请看一看。 任何建议,将不胜感激。谢谢您的提前帮助。
我以为我可以将编码更改为UTF-8,但我却无法。(由于我的编程经验短)
[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, string lpsz2);
[DllImport("user32.dll")]
public static extern int SendMessage(int hwnd, int wMsg, int wParam, string lParam);
[DllImport("user32.dll")]
public static extern uint PostMessage(int hwnd, int wMsg, int wParam, int lParam);
public void SendKatalk(string title, string msg)
{
int hd01 = FindWindow(null, title);
int hd03 = FindWindowEx(hd01, 0, "RichEdit20W", "");
SendMessage(hd03, 0x000c, 0, msg);
PostMessage(hd03, 0x0100, 0xD, 0x1C001);
}
private void Button1_Click(object sender, EventArgs e)
{
SendKatalk("Sol", "안녕하세요.");
}
我期望输出안녕하세요。但它打印?????。代替。