|
-
August 6th, 1999, 04:31 PM
#1
How do I set up my own message in message map?
Hi,
I want to setup my own message (MM_REFRESH), and I don't know what exactly to do. Funny how none of my 5 books say anything on this.. hehe.
Anyways, I thought that I should enter
afx_msg void OnRefreshTerm();
to the message map in the header file. I then thought I should add ON_MM_REFRESH() to the message map in the cpp file.
What am I doing wrong here? I want MM_REFRESH to execute OnRefreshTerm().
Iwould also like to know what the proper way to call the message is. (ie this->SendMessage(MM_REFRESH, ???, ???);
Thanks
-
August 6th, 1999, 05:48 PM
#2
Re: How do I set up my own message in message map?
In the message map you should put:
ON_MESSAGE(MM_REFRESH, OnRefreshTerm)
HTH,
James Armstrong
-
August 6th, 1999, 05:50 PM
#3
Re: How do I set up my own message in message map?
MFC doesn't know about your message, so it's not going to have a pre-defined macro (#define) called ON_MM_REFRESH. Instead, you have to use ON_MESSAGE in your message map, like this:
ON_MESSAGE(MM_REFRESH, OnRefreshTerm)
If you are sending from the saying object (sending to "this"), then just call SendMessage(MM_REFRESH, ...). The other two parameters depend on what the function that handles the message expects for wParam and lParam.
Hope this helps,
Brad
-
August 6th, 1999, 06:01 PM
#4
Re: How do I set up my own message in message map?
The first thing you want to do is to place a constant that represents the message in the overall header file:
#define WM_REFRESH (WM_USER+1)
Next connect the message to the handler with the macro in the message map:
BEGIN_MESSAGE_MAP(.. , ..)
ON_MESSAGE(WM_REFRESH,OnRefresh())
END_MESSAGE_MAP()
Lastly, place prototype of OnRefresh in the class header and write the fuction itself.
Enjoy........
-
August 8th, 1999, 12:17 AM
#5
Re: How do I set up my own message in message map?
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
|