Create a window by MFC programming

Hi,
This is my first MFC programming application. It creates a windows with title "Windows Application".

Actually, this code is from a book I am reading. I just typed it and built it,
It worked well.
However, I am confused where the program starts.
As in C, it should be the first instruction in main() function. But here it seems very confusing.
Could you help me?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <afxwin.h>



class CSimpleFrame : public CFrameWnd
{
public:
CSimpleFrame()
{
// Create the window's frame
Create(NULL, "Windows Application");
}
};



struct CSimpleApp : public CWinApp
{
BOOL InitInstance()
{
// Use a pointer to the window's frame for the application
// to use the window
CSimpleFrame *Tester = new CSimpleFrame ();
m_pMainWnd = Tester;
// Show the window
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
};


CSimpleApp theApp;
Morning too!
I am reading the book "Visual C++ and MFC Programming" by FunctionX, Inc.
Here is the ebook version:
http://www.functionx.com/visualc/Lesson07.htm
I just read reviews about the book you recommmended. It seems to be a great book with depth inside how things work.
Is it intended for much more advanced people?

If I understand that correctly, the program starts at virtual BOOL InitInstance( ) function.However, I am still very confused.

Here is what I thought.
1. First Create(NULL, "Windows Application") in class CSimpleFrame is executed and it will create a windows.

2. BOOL InitInstance() is called and m_pMainWnd is pointed to that windows.Actually, I don't see how this is done above.

3. What is the purpose of this variable, CSimpleApp theApp? I don't see it used elsewhere.

Hope you can see what I am thinking wrong.
Why not let the wizard generate a project and take a look at that?
Topic archived. No new replies allowed.