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

Basic knowledge

The differences and relations among Win32 console application, Win32 project and MFC Application

1, difference

            (1) the Win32 console program has no interface but command characters. The generated ". Exe" file can be operated directly.

            (2) Win32 project, with interface. But the controls in the interface basically need to be implemented by themselves.

            (3) MFC applications also have interfaces. The controls in the rice interface do not need to be implemented by themselves. The commonly used controls have been written in the MFC library and can be dragged directly.

            (4) the interaction between console and win32mfc is different. The former adopts CML (command mode) and the latter GUI (user interface)

            (5) the interface of Win32 project is more in line with the UI design, while the interface of MFC application is basically the same, because they all use the same set of control templates.

            (6) Win32 console program: the initial code template takes main as the program entry. By default, it only links the C + + runtime library and some core Win32 libraries. The linker subsystem parameter is of console type, so the compiled program will have a black console window as stdin and stdout.

            Win32 project: the initial code template implements a simple windows window, takes WinMain as the program entry, references the win32API header file and library, the linker subsystem parameter is windows, so the generated program does not have a black console, directly uses the standard input and standard output, and has no effect.            MFC application: in essence, it is a WIN32 project. It only references the header files and libraries of the MFC framework by default, and the program entry is provided by the MFC framework without writing by yourself.


            2. How to choose?

            Console or Win32 MFC depends on whether it needs to interact with users and the frequency of interaction. Some software needs to view the editing results in real time, so it needs windows; some programs, such as Trojan horse programs, do not use windows to avoid exposing themselves.

            (1) wn32 MFC is used to interact with users in a large amount or to meet the requirement of "what you see is what you get". Console is used instead of interaction or little interaction.

            (2) only emphasize practicality and development efficiency, use MFC; emphasize user experience and software details, use Win32. MFC can be achieved, Win32 can be achieved. On the contrary, we can't.


            3. Contact? 

           Windows provides Win32 API for programmers to complete various operations, so console, Win32, MFC can directly call Win32 API. But it is too complicated to directly use Win32 API to complete operations such as creating windows and displaying windows with code, so we combine these codes to extract them and turn them into classes in OOP, namely Microsoft basic class library (MFC) 


           4. (1) Win32 console program: the initial code template takes main as the program entry. By default, it only links the C + + runtime library and some core Win32 libraries. The linker subsystem parameter is of console type, so the compiled program will have a black console window as the rendering standard input (stdin) and standard output (stdout).

            (2) Win32 project: the initial code template implements a simple windows window, takes WinMain as the program entry, references the win32API header file and library, the linker subsystem parameter is windows, so the generated program does not have a black console, directly uses standard input and standard output, and does not see the effect.

            (3) MFC application: in essence, it is a WIN32 project. It only references the header files and libraries of the MFC framework by default, and the program entry is provided by the MFC framework without writing by yourself.    

        ————————————————

            Copyright notice: This is the original article of CSDN blogger "snail walking", which follows CC 4.0 by-sa copyright agreement. Please attach the original source link and this notice for reprint.

            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