Posted on 2000-05-11
I am a newbie trying to learn MFC through self-study. Came across this section of code from the MSDN library, on which I have some questions. Would appreciate help. Thanks.
Referring to the code appended:
What is the return type of InitInstance() and InitApplication()? When is it legal to declare the prototype without a return type?
Why must the prototypes of these two functions be declared? If the code had #included <afxwin.h> (and therefore the two functions would have been implemented as member functions of MFC class WinApp), would there be a need to declare the prototypes of these two functions, or could I just have used CWinApp::InitInstance() straight without the prototype declaration? Is the prototype declarations made necessary because InitInstance() and InitApplication() are overridden?
// Global variable
// Function prototypes.
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
InitApplication(HINSTANCE); //<-- ?
InitInstance(HINSTANCE, int); //<-- ?
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
// Application entry point.
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)