How to minimize console window?

后端 未结 2 710
名媛妹妹
名媛妹妹 2021-01-18 14:41

I am running a C++ console application, for some period of time,
I want to minimize the window in which my application is running.
for eg. I launch myApp.exe from cm

2条回答
  •  无人及你
    2021-01-18 14:53

    Another option is to change

    Properties... | Configuration Properties | Linker | System | Subsystem

    from Console to Windows. However, you then need to add a WinMain() entry point, such as:

      int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
      { int argc = 0;
        LPWSTR* argv = CommandLineToArgvW(GetCommandLine(), &argc);    
        return Main(argc, argv);
      }
    

    assuming unicode. To avoid confusion, I rename the console's wmain() function to something like Main(), as above. Of course printf no longer has a console to write to.

提交回复
热议问题