Is there a #define associated with the SubSystem

前端 未结 3 795
情书的邮戳
情书的邮戳 2021-01-08 00:42

I\'m creating main with a macro and need to be able to check the selected SubSystem at compile time, /SUBSYSTEM:WINDOWS or /SUBSYSTEM:CONSOLE, in order to generate the appro

3条回答
  •  太阳男子
    2021-01-08 01:25

    That's not how it really works. You have to write dramatically different code in a console app vs a native Windows app. In a console app, you use printf or cout to produce output, don't have much if any use for a mouse. A native Windows app requires a message loop and creating a window with a window procedure that detects the WM_PAINT message to update the window. Etcetera.

    But you can write code that does both. Just write both a main() and a WinMain() function, the CRT automatically calls the correct one.

提交回复
热议问题