简体   繁体   English

如何让我的程序在屏幕上出现和消失

[英]How to make my program appear and disappear on the screen

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我的程序模拟了一些鼠标移动,但是 cmd 屏幕保持打开状态,我想放一个键从屏幕上出现和消失,另一个键让它完全关闭

If "cmd screen" is meant as Windows console then there are simple Windows API calls:如果“cmd 屏幕”是指 Windows 控制台,那么有简单的 Windows API 调用:

// 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.您需要为这些包括 windows.h。 As you wrote that you alter mouse you have likely done it already.正如您所写的那样,您更改了鼠标,您可能已经完成了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM