Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • What if there's a form and a console open at the same time? What would the function return? And would it be semantically true? Commented Dec 28, 2009 at 22:20
  • @Aviad: There is no clean way to achieve this on Windows. An executable can be compiled for only one of the available subsystems, e.g. the Windows character of subsystem (a console app) or the Windows GUI subsystem (or native, OS/2 or Posix). Of course you can attach a console to a window application, but the application will still remain a window application. Commented Dec 28, 2009 at 22:24
  • That may be true for a native executable, but not for a .NET one. Commented Dec 28, 2009 at 22:26
  • .NET executables are in PE format just as native Win32 applications, therefore this holds also for .NET executables. You can check it from the VS command prompt: dumpbin /HEADERS myapp.exe will display the PE headers. Look for the line showing the subsystem. A value of 2 means Windows GUI and a value of 3 means Windows CUI (console app) (see msdn.microsoft.com/en-us/magazine/ms809762.aspx). Commented Dec 28, 2009 at 22:42
  • 2
    Ok, but that flag is somewhat insignificant for a .NET application which may open a console, a form and a WPF host all together... That's all I'm trying to say. Maybe it answers the original poster's problem, and maybe it doesn't, that's for him to say. In my opinion tho, all things being equal, that flag is insignificant for a .NET application. Commented Dec 28, 2009 at 22:48