MFC helps us talk to Windows. MFC is a service company.
MFC is equivalent to some tertiary industries, such as restaurants, such as enterprise ISO9000 certification consulting companies, such as business license agency.
All the reasons are that these things are complicated, so we introduced MFC to help us.
In fact, it is the same as that of the certification consulting company that helped us prepare reports and then contacted the certification authority. MFC communicates with the god of windows through APIS. we may not remember how to chat with God, but MFC knows the processes. if you can talk about it by yourself, you can intercept a few words when you help you with MFC.
Let's talk about the elements of talking to Windows God first. the most important thing is the handle (memory address), because in windows, there is only a memory space address. for example, if you ask windows to help you write a word in the window of your program (Remember, it is actually written by windows. Don't think that writing a few codes will write on the screen ), then you have to tell windows the address of your window memory, and then tell it on what coordinates. in this case, the memory address is located in windows, and the memory address is added to the relative Space Location Based on coordinates. At this time, words are written there. then other departments (display drivers) write words to the screen
For the above operations, if you talk to Windows yourself, you have to do two things. The first is to get the handle and the second application.
If it is called MFC, He will give you a CDC pointer in the view. You only need to call the CDC member function to help you textout, and handle it to help you.
A program is a process. The memory allocated to your program is encapsulated into a whole. The pointer you get in the program is a relative pointer starting from 0, and the handle is an absolute pointer. the handle is used when you talk to Windows. you only need to use relative pointers when using them. MFC helps you hide absolute pointers, making you feel that your world is a perfect world starting from 0. sometimes we find that the old bird is very natural, and the new user is confused. Why should we use a handle. if you want windows to do things for you, you can use a handle, just like us dollars is internationally used. if you use RMB in your own country, if you want to use RMB to buy things abroad, you have to contact the bank for exchange. MFC also has such a function, and can also help you proxy to do anything. just like online shopping, but you are doing virtual operations, and you only see product images.