NO MFC Programming 01 - The most streamlined Win32 program

zhaozj2021-02-16  42

Here you introduce Win32 programming without MFC

Below you should use VC to make a thinnest Win32 program, please don't laugh, can you use the frame!

The first stage: the streamlined code is not much, see the following source program

// filename: WinMain.cpp

/ / Specify the next sentence to speed up the compilation speed #define win32_lean_and_mean // Say no to mfc !! #include

INT WinAPI Winmain (Hinstance Hinstance, Hinstance Hprevinstance, LPSTR LPCMDLINE, INT NCMDSHOW) // Parameter is fixed format, no way {省 省 {

// If you want to prove what the program has done, remove the double slash below, (too basic) not to say. // MessageBox (NULL, "Hello World", "Simple_code by Temp77", MB_OK);

EXITPROCESS (0); return null; // For complete and reserved, don't do not miss}

Write an empty Win32 project with a direction, add it to it, compile, 0 Error (s), 0 Warning (s).

First stage

second stage:

(The content of the following is coming from an article, it is useful to me.)

Since it is the most streamlined program, what else is there? Oh, yes, it is too big, you can imagine how to almost don't do anything is 28K?

Then prepare the project file operation of the program.

First remove the Debug property, the method will fall (Win32 Debug) Remove in the menu bar (Build -> Configurations ...).

Replace the LINK settings, the method is in the menu bar (in the Project -> Settings ...), select the Link tab. In the option before "Ignore All Default Libraries, the" Object / Library Modules: "The big string in the edit box is all deleted, re-filled" kernel32.lib user32.lib msvcrt.lib "(surgery processing... )

Finally, see "Project Options:" The edit box under "Project Options:" Is there a long major string? However, please don't delete it, just add a space, then fill in "/ align: 4096" to declare the smallest section. (Surgery completed)

Compile it to see, (oh, there is a Warning, no matter how much actually generated executable " Yes, you don't miss the wrong, 3K!

Ok, the second phase ends.

This article is useful for some people, and others are useless! September 27, 2002 PM 5:42

----------------------------------------------

Self-introduction:

转载请注明原文地址:https://www.9cbs.com/read-24609.html

New Post(0)