My program simulates some mouse movements, but the cmd screen remains open, I would like to put a key to appear and disappear from the screen, and another key for it to close completely
Asked
Active
Viewed 99 times
-1
-
3Is it for windows? Add tag if it is. There are no platform independent solutions for that. – Öö Tiib Jan 16 '22 at 22:26
-
So, you're trying to control a PC without it looking like you're controlling the PC? Not cool. – 3Dave Jan 16 '22 at 22:43
1 Answers
1
If "cmd screen" is meant as Windows console then there are simple Windows API calls:
// this hides console window
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
// this shows
::ShowWindow(::GetConsoleWindow(), SW_SHOW);
// this checks visibility
if (::IsWindowVisible(::GetConsoleWindow())) {
// do your things
}
You need to include windows.h for those. As you wrote that you alter mouse you have likely done it already.

Öö Tiib
- 10,809
- 25
- 44
-
tnks, I'm not able to put a key, it's giving some errors that I don't know, can you put it to appear and disappear on the INSERT key? – Is ktt Jan 16 '22 at 22:53
-
That is more complicated. Answer to that question should help: https://stackoverflow.com/questions/41212646/get-key-press-in-windows-console You should ask every question as separate, that helps next people to search answers. – Öö Tiib Jan 16 '22 at 23:04