meow00
asked on
BEGIN_MESSAGE_MAP ....
Hi Experts,
Can anyone please tell me what do "BEGIN_MESSAGE_MAP" and "END_MESSAGE_MAP" do ? also, how are they different from "afx_MSG_MAP" ? Thanks !
meow
Can anyone please tell me what do "BEGIN_MESSAGE_MAP" and "END_MESSAGE_MAP" do ? also, how are they different from "afx_MSG_MAP" ? Thanks !
meow
ASKER
..... thanks for the information .... so what is "macro" ? how is it defined and used exactly ? thanks !
meow.
meow.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> Virtual functions are not space-efficient because they require vtables, and vtables > consume memory even if the functions in them are not overridden. The amount of > memory used by a message map, in contrast, is proportional to the number of
> entries it contains.
There are at least two downsides to using message maps, however:
1) They are not type-safe. One of the primary reasons MFC programs work in debug but crash in release build is that a handler has been added to the message map by hand and it doesn't have the right prototype for that message.
2) They are not time efficient. Instead of having a nice efficient vtable it has to search through (possibly) multiple message maps until it finds an entry to handle the event.
In the days of 8 mb Windows systems the message map might have been a good choice; if the MFC developers were doing this today I wonder if they would make the same choice.
> entries it contains.
There are at least two downsides to using message maps, however:
1) They are not type-safe. One of the primary reasons MFC programs work in debug but crash in release build is that a handler has been added to the message map by hand and it doesn't have the right prototype for that message.
2) They are not time efficient. Instead of having a nice efficient vtable it has to search through (possibly) multiple message maps until it finds an entry to handle the event.
In the days of 8 mb Windows systems the message map might have been a good choice; if the MFC developers were doing this today I wonder if they would make the same choice.
I don't know what an "afx_MSG_MAP" is; if you are referring to the line in a header file that looks like
//{{AFX_MSG(CMyClass)
it's a marker for Class Wizard to know what was created by the Class Wizard.