Something before "void function ();"

Hello again Experts.

Hi... As many of yours know... I'm migrating from VB to VC++.

It is a simple question.
I will ask about my doubts here as they appear to me...
I reached the the first chapter about
MFC.
In the book I have this code.

class CMyDrawApp : public CWinApp
{
public:
      CMyDrawApp();


// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CMyDrawApp)
      public:
      virtual BOOL InitInstance();
      //}}AFX_VIRTUAL

// Implementation
      //{{AFX_MSG(CMyDrawApp)
      afx_msg void OnAppAbout();
            // NOTE - the ClassWizard will add and remove member functions here.
            //    DO NOT EDIT what you see in these blocks of generated code !
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

The thing that doesn't let me sleep here is "afx_msg void OnAppAbout();"

What does "afx_msg" mean... It is before a function declared as void.

It is the firs time I see something like this...
The whole code was succefully compilated.

And by the way...
Should I declare the API calls if I want to use them... or the compiler assumes that they exist?.


Thanks.
LVL 1
MarscAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gothickCommented:
afx_msg actually means nothing at all to the compiler -- it is #defined to nothing, so the compiler never sees it.  The reason it is there is so that Visual C++ can tell that it's a message-handling function which has been automatically generated by the ClassWizard.  You can verify that it's defined to nothing by right-clicking on it in the editor and choosing "go to definition" -- that should show you where it is defined.

That's also the reason for the "//{{AFX_MSG(CMyDrawApp)" and the other lines that look like that -- they're just there so that the ClassWizard doesn't get confused.

As for API calls, virtually all of them are defined in "windows.h", which will nomrally have been included for you automatically (somewhere along the line) with a AppWizard-generated windows application.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarscAuthor Commented:
Well... I'm going to see it...

Thank's for your help.
0
MarscAuthor Commented:
I'm sorry...
I wanted to accept your answer... but
I forgot to select that :)

Thanks again.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.