Calling MessageMap functions
-
Hi, I have MessageMap fucntion in Mainfrm.H I want to use this function in another class.But the messagemap functions are protected i can't use this in another class. Can i use public out of message map and declared the required fucntions in Public and then use it. Is this correct way? Or is there any other option in it. protected: //{{AFX_MSG(CMainFrame) afx_msg void OnCursessInfo(); I changed this to (after the line /}}AFX_MSG ) public: afx_msg void OnCursessInfo();
Anu
-
Hi, I have MessageMap fucntion in Mainfrm.H I want to use this function in another class.But the messagemap functions are protected i can't use this in another class. Can i use public out of message map and declared the required fucntions in Public and then use it. Is this correct way? Or is there any other option in it. protected: //{{AFX_MSG(CMainFrame) afx_msg void OnCursessInfo(); I changed this to (after the line /}}AFX_MSG ) public: afx_msg void OnCursessInfo();
Anu
A message map "just" maps incoming messages to methods, it shouldn't care if the given method is accessible from outside of the class or not, so basicly making it public is ok, just not too nice. As an alternative, you could call these methods thorough the message map by using SendMessage or PostMessage.
AtomAnt - If God wanted man to code, man would have been born without the need to sleep.
-
A message map "just" maps incoming messages to methods, it shouldn't care if the given method is accessible from outside of the class or not, so basicly making it public is ok, just not too nice. As an alternative, you could call these methods thorough the message map by using SendMessage or PostMessage.
AtomAnt - If God wanted man to code, man would have been born without the need to sleep.
-
A message map "just" maps incoming messages to methods, it shouldn't care if the given method is accessible from outside of the class or not, so basicly making it public is ok, just not too nice. As an alternative, you could call these methods thorough the message map by using SendMessage or PostMessage.
AtomAnt - If God wanted man to code, man would have been born without the need to sleep.
How does one get the 'UNIT message' of the, say ONPAINT, function in the other class? To get a dialog in a CTabCtrl to initialize when selected, unique identifiers (WM_APP + 1)were defined and sent. This works fine as the WindowProc function receives the message and then branches to the appropriate initialization. Would one have to do a user defined message to the WindowProc in the other class, and then issue the function call? Thanks.