|
-
March 5th, 2004, 02:19 PM
#1
Basic messaging question
InInitInstance I send a message to send a message to ManFrame
but ManFrame never get the message. It looks like this,
AfxGetMainWnd()->SendMessage(UM_CREATE_THREAD, 0, 0);
In MainFrame.h I have added afx_msg void OnCreateThread();
, like below
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnFilePrint();
afx_msg void OnFilePrintPreview();
//}}AFX_MSG
afx_msg void OnCreateThread();
DECLARE_MESSAGE_MAP()
In MainFrame.cpp I have added ON_COMMAND(UM_CREATE_THREAD, OnCreateThread) like below
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
//}}AFX_MSG_MAP
ON_COMMAND(UM_CREATE_THREAD, OnCreateThread)
END_MESSAGE_MAP()
Also in MainFrame.cpp I have added
void CMainFrame::OnCreateThread()
{
AfxMessageBox("Got the message");
}
But I never get the "Got the message" printed on the screen.
What is it I'm missing. Probably this is very basic but I would be very happy for an answer.
-
March 5th, 2004, 02:26 PM
#2
ON_COMMAND is used for WM_COMMAND messages. You are using a user defined message. Change ON_COMMAND to ON_MESSAGE.
-
March 5th, 2004, 02:36 PM
#3
-
March 5th, 2004, 02:43 PM
#4
I am assuming that worked, and you're welcome.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|