What is the difference between a console application and a Windows application in .NET at startup

Imagine when a .NET application starts after a build, either Console or WinForm. In addition complie-time flags, such as /subsystem, /out... how the operating system (currently Windows) or .NET virtual machine (I do not know what's going to catch the running application in the first place) which of window systems run and what does he do when he wants to run the right system?

+4
source share
1 answer

I see that the question has been updated to reflect this decision for comments by Frederick Hamidi, but to adhere to the Q & A Stack Overflow format, I admit this as an answer with the Wiki community flag set, according to “ Unanswered question, but the problem is resolved in the comments ( or advanced chat) .

There is a flag. In the executable itself, somewhere in the PE header. This flag is set during build and indicates the subsystem that the application wants to execute (GUI or console). The loader reads this flag and adjusts the console accordingly. This preceded .NET - the CLR does not bring anything new to the image here.

+2
source

Source: https://habr.com/ru/post/1548559/


All Articles