Difference between WinMain,main and DllMain in C++

后端 未结 3 1648
悲哀的现实
悲哀的现实 2020-12-13 05:01

What is the difference between the three functions and when to use them??

3条回答
  •  旧巷少年郎
    2020-12-13 05:40

    main() means your program is a console application.

    WinMain() means the program is a GUI application -- that is, it displays windows and dialog boxes instead of showing console.

    DllMain() means the program is a DLL. A DLL cannot be run directly but is used by the above two kinds of applications.

    Therefore:

    • Use WinMain when you are writing a program that is going to display windows etc.
    • Use DLLMain when you write a DLL.
    • Use main in all other cases.

提交回复
热议问题