Welcome: Hunan Intelligent Applications Tecgnology CO.,ltd.-HNIAT.com
Language: Chinese ∷  English

Basic knowledge

Differences and connections between Win32 console applications, Win32 projects, and MFC applications

1. Difference
(1) Win32 console program, no interface, only command characters. Run the generated ".exe" file directly.
(2) Win32 project with interface. However, the controls in the interface are basically implemented by themselves.
(3) MFC applications also have interfaces. The controls in the rice interface do not need to be implemented by themselves. Common controls have been written in the MFC library and can be dragged directly.
(4) The interaction between the console and Win32MFC is different. The former uses CML (command mode) and the latter is GUI (user interface).
(5) The interface of the Win32 project is more in line with the UI interface design; the interface of the MFC application is basically the same, because they all use the same set of control templates.
(6) Win32 console program: The initial code template uses main as the program entry. By default, only the C ++ runtime library and some core win32 libraries are linked. The linker subsystem parameter is console type, so the compiled program will be black. Console window as standard input (stdin) and standard output (stdout).
Win32 project: The initial code template implements a simple windows window with WinMain as the program entry, references the win32Api header files and libraries, and the linker subsystem parameter is windows, so the generated program does not have a black console and uses standard input and Standard output, no effect.
MFC application: It is essentially a win32 project, but it only refers to the mfc framework's header files and libraries by default, and the program entry is provided by the mfc framework. You do not need to write it yourself.
2. How to choose?
Whether to use the console or win32 MFC depends on whether you need to interact with the user and the frequency of interaction. Some software need windows to view the editing results in real time, so windows are needed; some programs, such as Trojans, do not use windows in order to avoid exposing themselves.
(1) wn32 mfc is required to interact with users in a large amount or to meet the "what you see is what you get"; no interaction is required or the interaction is minimal, and a console is used.
(2) Emphasize only practical and development efficiency, use MFC; emphasize user experience and software details, use WIN32. MFC can be achieved, WIN32 can be achieved. The opposite is not possible.
3. Contact?
Windows provides win32 api for programmers to complete various operations, so console, win32, mfc can directly call win32 api. But using win32 api directly, using code to complete operations such as creating windows, displaying windows, etc. is too complicated, so we combined these codes to extract them and turn them into classes in OOP, which is the Microsoft Foundation Class Library (MFC).
4. (1) Win32 console program: The initial code template uses main as the program entry. By default, only the C ++ runtime library and some core win32 libraries are linked. The linker subsystem parameter is of the console type, so the compiled program will There is a black console window for rendering standard input (stdin) and standard output (stdout).
(2) Win32 project: The initial code template implements a simple windows window. WinMain is used as the program entry. Win32Api header files and libraries are referenced. The linker subsystem parameter is windows, so the generated program does not have a black console. Use it directly. No effect on standard input and standard output.
(3) MFC application: It is a win32 project in essence, but it only refers to the header files and libraries of the mfc framework by default, and the program entry is provided by the mfc framework. You do not need to write it yourself.
————————————————
Copyright statement: This article is the original article of the CSDN blogger "SnailWalking", which follows the CC 4.0 BY-SA copyright agreement. Please reprint the original source link and this statement.
Original link: https://blog.csdn.net/zhao1999qian/article/details/57084143

CONTACT US

Contact: Manager Xu

Phone: 13907330718

Tel: 0731-22222718

Email: hniatcom@163.com

Add: Room 603, 6th Floor, Shifting Room, No. 2, Orbit Zhigu, No. 79 Liancheng Road, Shifeng District, Zhuzhou City, Hunan Province

Scan the qr codeClose
the qr code