class=”htmledit_views”>
C++ and C develop windows Application Difference
CLanguage:
Use a window handle HWND to complete various operations on the window (WND is windows internal private structure)
C++:
Use CWnd
Windows window and the difference between CWnd
CWnd is created by the constructor;
Windows window by <span lang="EN-US" of CWnd >Create function creation
CWnd class
Operate a HWND type data member: m_hWnd.
The difference between handle and pointer
The pointer corresponds to the address of a data in the memory, The pointer can modify the data freely
The handle cannot directly operate it, but calls the correspondingAPI by Function to operate.
Handle mapping mechanism (internal implementation mechanism)
MFC uses a CHandleMap to place the window handleMaps to C++window object;
(Question: Is this CHandleMap only one singleton class? Or create a MFC class creates a CHandleMap?)
This part is not very clear.
MFC and threads
MFC specifies,
1. Non-MFC threads cannot create and access MFC object.
(Question: What is MFC thread? How to create it?)
Answer: Only objects created by CWinThread can access MFC thread objects and using MFC objects.
(Question: Where is this CWinThread sacred?)
I feel that CWinThread is the class responsible for creating threads in c++.
2. A thread can only access MFC objects created by itself;
Module –Creation of thread state
It is done in the constructor of CWinApp.
MFC application will automatically generate a theApp, than WinMain was created earlier.