-1

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

drescherjm
  • 10,365
  • 5
  • 44
  • 64
Is ktt
  • 27
  • 2

1 Answers1

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