C++ How do I hide a console window on startup?

后端 未结 9 598
悲哀的现实
悲哀的现实 2021-02-01 05:43

I want to know how to hide a console window when it starts.

It\'s for a keylogger program, but it\'s not my intention to hack someone. It\'s for a littl

9条回答
  •  粉色の甜心
    2021-02-01 05:54

    So i wanna know why it opens a new console, instead of just only create and hide the first one.

    A console application doesn't actually create a console itself, it just runs in one. If you run the executable from Explorer, Windows creates a console for it to run in. When you call FreeConsole, it doesn't close the new console, simply detaches your process from it.

    As WhozCraig noted in the comments, create a regular Windows application and don't create a window.

提交回复
热议问题