Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About afx_msg

49 views
Skip to first unread message

lyo

unread,
Jun 26, 2003, 1:08:23 PM6/26/03
to
Why add a afx_msg do before my function.Before the
DECLARE_MESSAGE_MAP() MFC add a "afx_msg" before my
function.Help!

Peter M.

unread,
Jun 26, 2003, 1:57:32 PM6/26/03
to
Hi,

AFX_MSG() block is intended to indicate Class Wizard that within this block
some overrided functions are declared. Take for example CDialog::OnOK(),
this is virtual function which you can override. When you do so, declaration
of this function will be visible in Class Wizard window - you can see it in
the list of overrides of your base class. Why bother? MFC as far as I know
is not portable, even if it was, AFX_MSG is preceeded by // which means
comment...
Regards,
Peter


"lyo" <liyongq...@hotmail.com> wrote in message
news:02c701c33c05$8cbdd520$a101...@phx.gbl...

Joseph M. Newcomer

unread,
Jun 27, 2003, 12:00:46 AM6/27/03
to
The afx_msg is used to help the rather primitive VS6 ClassWizard recognize a message
handler declaration. It is a macro which expands to nothing at all. One of the significant
improvements in VS7 is that the funky comments required in VS6 are no longer required in
VS7. (I don't detest all of it, only the revisions that made it harder to use)
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Peter M.

unread,
Jun 27, 2003, 11:34:28 AM6/27/03
to
It's not even a macro, at least not in C/C++ meaning, rather some token.
Hopefully VC 7 is better, but some things were cut off, don't know why.
Peter


"Joseph M. Newcomer" <newc...@flounder.com> wrote in message
news:c8gnfv8hecddf3n8m...@4ax.com...

Joseph M. Newcomer

unread,
Jun 27, 2003, 12:26:27 PM6/27/03
to
Sorry, it is a macro. And absolutely and precisely in the C/C++ meaning. (It is also a
token, in the parser sense, but that isn't particularly noteworthy)

From afxwin.h, line 128
#define afx_msg // intentional placeholder

That is clearly a macro definition. It defines a macro of no parameters with an empty
body. But it is beyond any shadow of a doubt a C/C++ macro.
joe

Peter M.

unread,
Jun 27, 2003, 1:58:31 PM6/27/03
to

"Joseph M. Newcomer" <newc...@flounder.com> wrote in message
news:mqrofvktmqfmk2cb9...@4ax.com...

> Sorry, it is a macro. And absolutely and precisely in the C/C++ meaning.
(It is also a
> token, in the parser sense, but that isn't particularly noteworthy)
>
> From afxwin.h, line 128
> #define afx_msg // intentional placeholder
>
> That is clearly a macro definition. It defines a macro of no parameters
with an empty
> body. But it is beyond any shadow of a doubt a C/C++ macro.
> joe
>


I suppose we have a little misunderstanding. I rather thought about
//{{AFX_MSG() - this is purely token and a token only, intended for non
C/C++, internal use and nothing else. Of course you're right about afx_msg,
but I don't thing Lyo was really asking about afx_msg, from what I
understood he meant //{{AFX_MSG() - that's the string Class Wizard puts into
a header somewhere near message maps stuff. If I'm mistaken, correct me.
Regards,
Peter


Joseph M. Newcomer

unread,
Jun 28, 2003, 10:21:31 PM6/28/03
to
Reproduced from his original question:

Why add a afx_msg do before my function.Before the
DECLARE_MESSAGE_MAP() MFC add a "afx_msg" before my
function.Help!

He did not ask about //{AFX_MSG}, but about afx_msg, lower case, in a position before the
function, which is where the macro is used.
joe

Joseph M. Newcomer [MVP]

0 new messages