对话框:<SendMessage>
HWND hwnd=::FindWindow(NULL,"ReceiveMsg");
if(hwnd==NULL)
{
AfxMessageBox("没有找到接受消息的窗体");
return;
}
::SendMessage(hwnd,WM_ENABLEBUTTON,0,0);
说明:自定义:#define WM_ENABLEBUTTON WM_USER+100
对话框:<ReceiveMessage>
主要是对WM_ENABLEBUTTON所对应函数的处理
eg:也需要自定义#define WM_ENABLEBUTTON WM_USER+100
ON_MESSAGE(WM_ENABLEBUTTON,OnReceive)
void CReceiveMsgDlg::OnReceive(WPARAM wParam,LPARAM lParam)
{
if(wParam==0 && lParam==0)
{
GetDlgItem(IDC_BUTTON1)->EnableWindow(TRUE);
AfxMessageBox("修改完成");
}
}