使用SendMessage引发控件的双击事件

呵呵,其实很简单,你发送完了之后再单击一下TextBox控件,就可以发现事件处理执行了。
原因在于你还得再发送一个WM_LBUTTONUP消息。如下:

const int WM_LBUTTONDBCLICK = 0x203;
const int WM_LBUTTONUP = 0x202;

private void button1_Click(object sender, System.EventArgs e)
{
if(Win32API.SendMessage(textBox1.Handle,WM_LBUTTONDBCLICK ,0x1,0x0))
{
Win32API.SendMessage(textBox1.Handle,WM_LBUTTONUP ,0x1,0x0);
}
}

Published At
Categories with Web编程
Tagged with
comments powered by Disqus