从Windows 8桌面应用程序打开显示器 [英] Turning on the monitor from Windows 8 desktop app

查看:99
本文介绍了从Windows 8桌面应用程序打开显示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


全部:


我需要检测显示器的状态,如果关闭则打开电源......我与Windows 7配合得很好的实用程序(C ++ windows console)



SendMessage( HWND_BROADCAST ,WM_SYSCOMMAND,SC_MONITORPOWER,2);
$
System.Threading.Thread.Sl eep(5000);

PostMessage(HWND_BROADCAST < wbr>,WM_SYSCOMMAND,SC_MONITORPOWER,-1);
$


第一个发送消息关闭显示器,第二个SendMessage启动显示器



但是在Windows 8上,第一个SendMessage似乎可以工作 - 即显示器确实已关闭。但是,当我尝试通过第二个SendMessage打开显示器时,代码会执行,但是显示继续保持相同的状态,直到我明确
按下键盘上的键为止b


关于如何在Windows 8上完成此任何建议?
I have a need to detect state of the monitor and power it on if it is switched off... A utility program (C++ windows console) that I have works well with Windows 7

SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
System.Threading.Thread.Sleep(5000);
PostMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1);

The first send message switches off the monitor and the second SendMessage powers on the monitor

However on Windows 8, the first SendMessage seems to work - i.e. display is indeed powered off. However when I try to power-on the display through the second SendMessage, the code executes, however the display continues to remain in the same state until I explicitly hit the key in the keyboard

Any suggestions on how this can be done on Windows 8?

推荐答案

我在Win8中遇到同样的问题,但是我使用名为nircmd的工具:

I have the same problem in Win8, but I use a tool called nircmd:

ie

nircmd.exe监控关闭 - >工作正常

nircmd.exe monitor off -> works OK

nircmd.exe监控器 - >显示器开启几分之一秒后再自动关闭

nircmd.exe monitor on -> the monitor turned on for a fraction of a second and got turned off again by itself





这篇关于从Windows 8桌面应用程序打开显示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆