Aljoša Srebotnjak
Aljoša Srebotnjak

Reputation: 1331

What is the difference between win32 console and command prompt?

I am reading about console applications and I don't know how command prompt and win32 console are connected. Are they the same thing?

Upvotes: 1

Views: 1463

Answers (2)

Hans Passant
Hans Passant

Reputation: 941505

Your computer has many console mode programs. It has only one Cmd.exe. Which is the command interpreter, it displays a prompt and let you type commands to start other programs.

You ought to play with Dumpbin.exe, included with Visual Studio. Use its /headers option to look at the header of an executable file. Such a file indicates what sub-system it wants to run on. There are three common ones you can encounter:

  • 1, displayed as "Native". Targets the native Windows operating system, used by device drivers for example, the ones you find in c:\windows\system32\drivers. The native OS resembles VMS, the operating system that Dave Cutler and his team created when they worked for DEC. It is only partially documented, just the parts that you need to write a driver.
  • 2, displayed as "Windows GUI". A Win32 process that creates its own windows with CreateWindow(). Like Notepad.exe
  • 3, displayed as "Windows CUI". A Win32 process that needs a console window, the OS automatically creates it before starting the program. Like Cmd.exe

Windows used to have more sub-systems, like OS/2 and Posix, but they fell out of use. Win32 won by a land-slide. The distinction between the native OS and the api layer is also the core way Microsoft innovates on the OS, the Win32 api is frozen in stone and can never be changed, only added to. They can change the native OS as they see fit. Vista was the last one with very drastic changes, major version 6. Windows 2000 was the previous one, major version 5.

Upvotes: 3

Parth Sane
Parth Sane

Reputation: 587

I quote Wikipedia here. " Win32 console is a text user interfaceimplementation within the system of Windows API, which runs console applications. A Win32 console has a screen buffer and an input buffer, and is available both as a window or in text modescreen, with switching back and forth available via Alt-Enter keys."
Now what this essentially means is that a win32 console actually hosts the cmd (aka command prompt) for interfacing with the OS. May the Windows gods correct me if I'm wrong. But this is what it means. One is an application other is an interface (win32 console) for the application.

Upvotes: 0

Related Questions