Reputation: 1468
How could I close a cmd window when I start windows api written in c++, I'm still learning the code but am making some amateur programs such as 2048 game, that's my latest one but it's irritating to have both program window and cmd open at the same time even though cmd closes when the main window closes.
So I was wondering if there is a way to either minimize it or (even better) close/not open it.
Upvotes: 0
Views: 761
Reputation: 340
I know others have given you a better solution in comments. However I thought I would post the answer to your original question in case anyone else finds this.
Add this include file: #include <Windows.h>
Then run this command at the start of your program:
int main() {
FreeConsole(); // Removes the console window
...
}
Upvotes: 1