日期:2014-05-20  浏览次数:20956 次

WM_ENABLE问题
private   void   button1_Click(object   sender,   System.EventArgs   e)
{
int   xt=(int)FindWindowEx((int)FindWindow(null, "form1 "),0,null, "button3 ");
label4.Text=FindWindowEx((int)FindWindow(null, "form1 "),0,null, "button3 ").ToString();
label3.Text=xt.ToString();
//MessageBox(0, "3445 ", "33 ",0);
SendMessage(xt,WM_ENABLE,true,true);
//button2.Enabled=false;
}
xt是button3的句柄
send以后为什么button3还是false状态

------解决方案--------------------
[DllImport( "User32.DLL ")]
public static extern bool EnableWindow(IntPtr hWnd, bool bEnable);

建议你用EnableWindow()API看看
------解决方案--------------------
用spy++看看消息发出去没有
看sendmessage返回值多少
------解决方案--------------------
句柄没问题?
好像里面有很多嵌套的,你一步步跟踪看看,
理论上应该是可以的,我原先用过click是可以的