各位大侠请帮我看下这段代码:
这是消息映射表的内容
static UINT NEAR WM_MYREGISTEREDMSG= RegisterWindowMessage("MY_REGISTEREDMSG");
BEGIN_MESSAGE_MAP(CMessageHandle2Dlg, CDialog)
//{{AFX_MSG_MAP(CMessageHandle2Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_REGISTERED_MESSAGE(WM_MYREGISTEREDMSG,OnMyRegistedMsg)
ON_BN_CLICKED(IDC_FIND,OnFindWindow)
END_MESSAGE_MAP()
消息处理的内容:
void CMessageHandle2Dlg::OnFindWindow()
{
HWND hWnd=::FindWindow("#32770","QQ用户登录");
ASSERT(hWnd);
AfxMessageBox("我要你弹,你就给我弹~~~~~~~~~~~");
::SendMessage(hWnd,WM_MYREGISTEREDMSG,0L,0L);
/*::EnumWindows(MyEnumWindow,
(LPARAM)this
);*/
}
LRESULT CMessageHandle2Dlg::OnMyRegistedMsg(WPARAM wParam,LPARAM lParam)
{
AfxMessageBox("我要你弹,你就给我弹");
return 0L;
}
编译无错,但是当就是不能执行 ::SendMessage(hWnd,WM_MYREGISTEREDMSG,0L,0L);这个语句,请帮忙指导!