apologies if this a bit vague but I don't have the overview to be more incisive... I have been learning Windows C++ programming for a while now and started with console apps (without questioning things too much) and have now progressed to Win32 apps (DirectX etc). I think I have a reasonable idea what goes on when I initiate a Win32 app : WinMain, setting CallBacks for the message loop etc. However I have realised that I have no idea what goes on when I create a Win32 Console App. I define a _tmain function in VC++ inside a Console App project configuration which gets executed by a console window that 'magically' flicks into and out-of existence with the required linkage to the various iostreams eg. cin/cout. Presumably this is all set-up by the Win32 console app project build option that I select - however a cursory loo开发者_如何转开发k at the configuration options across the 2 builds doesn't really throw light on the difference. Would you provide/point-to a summary of what's going on...? Thanks.
It is the Subsystem link option for a C++ link target.
http://msdn.microsoft.com/en-us/library/fcc1zstk.aspx
The most useful kinds:
CONSOLE
Win32 character-mode application. The operating system provides a console for console applications. If main or wmain is defined for native code, int main(array ^) is defined for managed code, or you build the application completely by using /clr:safe, CONSOLE is the default.
POSIX
Application that runs with the POSIX subsystem in Windows NT.
WINDOWS
Application does not require a console, probably because it creates its own windows for interaction with the user. If WinMain or wWinMain is defined for native code, or WinMain(HISTANCE *, HINSTANCE *, char *, int) or wWinMain(HINSTANCE *, HINSTANCE *, wchar_t *, int) is defined for managed code, WINDOWS is the default.
The option is also available in the option dialogs in Visual Studio, don't have a way to provide screenshots right now (look under general(?) linker options)
精彩评论