向当前窗口按钮发送单击消息:
::SendMessage(m_hWnd,WM_COMMAND,MAKEWPARAM(IDC_BUTTON3,BN_CLICKED),0);
向其他窗口发送关闭消息:
HWND h = ::FindWindow(NULL,_T("Windows 任务管理器"));
if(h == NULL)
{
MessageBox(_T("h null"));
}
::SendMessage(h,WM_CLOSE,0,0);
向当前窗口按钮发送单击消息:
::SendMessage(m_hWnd,WM_COMMAND,MAKEWPARAM(IDC_BUTTON3,BN_CLICKED),0);
向其他窗口发送关闭消息:
HWND h = ::FindWindow(NULL,_T("Windows 任务管理器"));
if(h == NULL)
{
MessageBox(_T("h null"));
}
::SendMessage(h,WM_CLOSE,0,0);
转载于:https://www.cnblogs.com/longcheng2012/archive/2012/11/01/2749970.html