日期:2014-05-17 浏览次数:21217 次
public const UInt32 BM_GETCHECK = 0x00F0;
public const UInt32 BM_SETCHECK = 0x00F1;
public const UInt32 BM_GETSTATE = 0x00F2;
private void button4_Click(object sender, EventArgs e)
{
IntPtr hWndParent = FindWindow("WindowsForms10.Window.8.app.0.2bf8098_r16_ad1", "Form3");
IntPtr h = FindWindowEx(hWndParent, IntPtr.Zero, "WindowsForms10.BUTTON.app.0.2bf8098_r16_ad1", "checkBox1");
Message msg = Message.Create(h, BM_CLICK, new IntPtr(0), new IntPtr(0));
//点击hwnd_button句柄对应的按钮
//PostMessage(msg.HWnd, msg.Msg, msg.WParam, msg.LParam);
SendMessage(msg.HWnd, BM_SETCHECK, new IntPtr(0), null);
int i = SendMessage(msg.HWnd, BM_GETSTATE, new IntPtr(0), null);
}