我加入下面的代码,结果没有反应,按钮还是灰的?
::SendMessage(::GetDlgItem(GlobalsDlg,IDC_BUTTON1),WM_ENABLE,1,0);

解决方案 »

  1.   

    The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. 
    发送是没有用的,只有接收处理这个消息
    使用EnableWindow
      

  2.   

    我是在一个线程中向对话框发WM_ENABLE消息的
      

  3.   

    那我在线程中怎么取消对话框的Disable呢?
      

  4.   

    那我在线程中怎么取消对话框里的按钮的Disable状态呢?
      

  5.   

    EnableWindow(hWndDlg,TRUE); Enable the button
    EnableWindow(hWndDlg,FALSE); Disable the button
    Please refer to MSDN for detailed information.
      

  6.   

    CXXDlg * pdlg;//这是个全局变量,给线程函数用的
    .....
    //在OnInitDialog()中
    pdlg=this;.....
    //在线程函数中,ID_XXX就是按钮的ID
    pdlg->GetDlgItem(ID_XXX)->EnableWindow(true);
      

  7.   

    或者你在线程中向应用发一个自定义消息,应用中写对应的消息响应函数,函数的内容就是Enable那个按钮