In layman's mfc[notes]

Source: Internet
Author: User
Tags call back getmessage

The operating nature of the 1.Windows program: Message-based, event-driven (msg based,event driven).
2. The program calls the GetMessage API loop to get the message, and the program's life is driven by it.
MSG msg;
while (GetMessage (&msg, NULL, NULL, NULL)) {
TranslateMessage (&MSG);
DispatchMessage (&MSG);
}
The four parameters of 3.WinMain are passed in by the operating system.
int CALLBACK WinMain (hinstance hinstance, HInstance hprevinstance,
LPSTR lpcmdline, int ncmdshow)
4.TranslateMessage is to convert the keyboard message, DispatchMessage will pass the message to the window function to deal with. DispatchMessage the message to the window function after the user module's assistance.
5.Call back function means a function [called by Windows System] in your program. Although these functions are designed by you, they are never and should not be called by you, they are prepared for Windows systems.
LRESULT CALLBACK WndProc (HWND hwnd,uint message,wparam wparam,lparam LPARAM)
The default of switch for 6.WndPro functions must be called: DefWindowProc, which is the message handler function for Windows internal presets.
7.Message Map: A message or system command binds a general-format function (a function pointer) in a list and, in Wndpro, compares the message or system command to invoke the corresponding binding function.
The activation and completion of the 8.Modal dialog box depends on the DialogBox and EndDialog two API functions. When the message is processed, it should be passed back to true, or false if the message is not processed.
9. The end of the thread of execution there are two situations, one is to die (ExitThread), the other is to have a good ending (TerminateThread).
10. The execution thread has a priority range from 0 (lowest) to 31 (highest).
11. By the behavior determines the design, how with thereby how to achieve the purpose of the design structure.
12.[object, encapsulation, class [Inheritance, derivation, subclass inherits all member variables and functions of the parent class] [virtual function represents derivation, inherited function interface, variation function content]
13. Call the parent category of the function, you must use the scope resolution operator (::) explicitly indicated.
14. (except for virtual functions) calls to which function must be dependent on the original type of the pointer, regardless of the object the pointer actually refers to.
15. If you anticipate that a derived class might redefine a member function, then you would set this function to virtual in the base category.
16. The same instruction evokes different functions, called polymorphism (polymorphism). The purpose of the polymorphism is to allow the program code that deals with [the object of the base class] to continue to properly handle [the object of the derived class] completely and thoroughly.
17. A pure virtual function does not need to define its actual action, it exists only to be redefined in the derived class, just to provide a polymorphic interface.
18. Virtual function derivation continues to be a virtual function, and can omit the virtual keyword.
19. Statically static member variables are initialized outside the class and are independent of the object. The static member function [without this parameter] has the property of being called to execute without resorting to any object.
There are two kinds of template for 20.c++, one for function and another for class.
21. Place the trace macro anywhere in the program, for example: Trace ("Hello World");
22.CObject is the water of the first, where the class derived from the CObject, can inherit a number of object-oriented important nature.
23.AfxOutputDebugString exports the string to the Debug debugger.
24.CWINAPP represents the program ontology. CFrameWnd represents a main frame window.
25. To use a function as a callback function, you must tell the C + + compiler not to put the this pointer as the last parameter of the function. Two ways to do this: 1. Do not use a class member function (that is, you want to use a global function) as the callback function. 2. Use the static member function. That is, precede the function with a static modifier.
26. Anything declared as static, regardless of function or variable, is not combined with the object, which is part of the category and does not belong to the object.
27. The action of file reading and writing is carried out in CDocument's Serialize function, and the action on the screen display is performed in CView OnDraw or OnPaint function.
28. Any class that uses declare_dynamic or declare_dyncreate or declare_serial macros at the time of declaration will have a static (static) CRuntimeClass inline object.
29. Executes the execution period of the thread function, which is the lifetime of the execution thread.

In layman's mfc[notes]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.