"MFC" Helloworld

Source: Internet
Author: User

More should be said is a common Win32 program of Hello World. Always VC6.0 is often used for exams, the school teaches the program are some DOS interface console program, even to C + +, the original thought was full of the DOS interface upgrade to the win interface, the results I was surprised to find, but on the basis of C added a lot of what class, and then inherit, encapsulate , polymorphic, constructors, disjunction I'll tell you a lot, and a whole bunch of man-in-the-gods with you. int main () is more than void main () is correct, angry Cao Classic rectification textbook and so on, really is to destroy my three views, I even have not written the program, which have empty care of you these grammatical problems. Into the big things are informal, anyway this kind of people do not discuss these issues with me, I am not free, you play slowly.

The following is the classic new project interface in VC6.0:


Don't ever write Win32 Console application, I want to write my own win32!

Results on-line search data, found that the network of MFC, WIN32 are very complex, not to a class to speak thoroughly, personally think this is not necessary. All I want to do is remember how to write a program, and then look at each line of code, which is right. The beginning of smallpox and Phoenix, the cart before the horse!

OK, noisy also spit out, how to write a form HelloWorld?

In fact, quite simple:

1, open VC6.0, file--new. Project tab, which is the interface

Enter the project name and save path to the right, click OK

2, then, Pop a dialog box, do not like to write the C language as directly point "OK", select "A simple Win32 program", to, not a C of an empty project, nor directly choose a typical "Hello World" program, rest assured that if you choose 3rd, Cliff's a half-day-long mess.


3, click "OK", expand the left side of the program tree, double-click the WinMain method


4, after, in return0 this sentence above input:

MessageBox (NULL, "Hello World", "title", MB_OK);

The first parameter, NULL, and the last parameter, MB_OK, specifies the action, the second parameter "Hello World" is the contents of the dialog box, and the third parameter "title" is the caption of the dialog box.

is where you want to enter this statement:


That is, the whole program becomes this:

Helloworld.cpp:Defines the entry point for the application.//#include "stdafx.h" int apientry WinMain (hinstance Hinsta NCE,                     hinstance hprevinstance,                     LPSTR     lpcmdline,                     int       ncmdshow) {//Todo:place code here. MessageBox (NULL, "Hello World", "title", MB_OK); return 0;}

5, then like the C language, compile, run, get the following effect, on a let you click OK dialog box, this is a simple Win32 form HelloWorld program, even MFC is not



On this node, I don't even want to know what the HINSTANCE is! I don't need to know that a simple HelloWorld is coming out. Anyway, some scholars like to emphasize that each statement is not to understand the programming!

"MFC" Helloworld

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.