The tangle of the first MFC Application

Source: Internet
Author: User

I 've been on the forum for some time and learned a lot. I only remembered it today. I have never summarized it.

Let's talk about the first MFC of my cainiao. If that's not good, you are welcome to shoot bricks ..

MFC (Microsoft basic library), for a long time, I always thought that Windows Forms are mfcapp, and later I showed off to others, however, Visual C ++ 6.0 Object-Oriented Programming appeared in front of me. I felt that my previous views were incorrect. Both of them are Win32 programs, but the two forms are different. c ++ later supported the form program because of this. . NET platform, and previously, this platform does not support C ++, so at the beginning of the VC ++ 6.0 form is only what classes are provided by the MFC class library.

Let's look at the cproview class's ondrow (CDC/* PDC/). I used it because of an error saying that I didn't declare PDC, then I defined a CDC * PDC Object Pointer according to this definition, but it can only be used. You cannot use->. Later, you can modify it. In the end, you will find that the parameter is passed in. You cannot define it yourself, so you despise yourself. Another strange thing is that when I used PDC-> textoutw (int n, int N, const char & S), I found that PDC-> textoutw (100,100. "Hello, world") the error indicates that a char [13] array cannot be converted to the const char type. This is depressing. Why is it wrong? It turns out to be a unicode problem, the previous char only occupies one byte. Now Char has become two bytes, so you need a _ T () macro to change each character in the character array from single to double, so that it is OK. Compilation is great.

When talking about pointers and dots, I really feel a little useless. What is the use of pointers? When is the use of pointers? Let me first say what I think: 1, when the required members are generic (neither Pointer --), vertices are used. Otherwise, pointers are used. Therefore, after the pointer is defined, only-> is required for the member to be called, and suddenly think of pure virtual functions. Pure virtual functions are generally similar to interfaces in C # in abstract classes. They cannot be instantiated, but can be defined as pointers. You can use a pointer to override the virtual function of the subclass. In this way, a "parent class cannot be written, but my subclass can still be used" will be used in this case->

La la! That's it.

                                                                                                                                                                                                                                                                                                                   

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.