关闭远程电脑上的显示器
我正在修复 Windows 远程控制(类似远程桌面)应用程序中的一些错误。 还有一个功能,您可以在远程计算机上黑屏 - 所有程序都保持运行不受影响,但查看远程 PC 显示屏的人只看到黑屏。
它是通过发送IoCtl请求IOCTL_VIDEO_SET_OUTPUT_DEVICE_POWER_STATE
来实现的,该请求没有文档记录。并且这个请求在Vista及以上版本不起作用。
还有其他方法可以做我想做的事吗?
事实上,SendMessage(-1,WM_SOMMAND,SC_MONITORPOWER,2)
可以解决这个问题,但如果有人触摸键盘/鼠标,屏幕会重新打开。
I'm fixing some bugs in the application for remote control (remote desktop-like) for Windows.
And there is a feature that you can blank screen on remote machine - all the programms keep running unaffected, but the person who looks into the display on remote PC sees nothing but black screen.
It is implemented by sending IoCtl request IOCTL_VIDEO_SET_OUTPUT_DEVICE_POWER_STATE
, which is undocumented. And this request does not work on Vista and above.
Are there another ways to do what I want?
In fact, SendMessage(-1,WM_SOMMAND,SC_MONITORPOWER,2)
does the trick, but screen turns back on if someone toches keyboard/mouse.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够发送 WM_SYSCOMMAND SC_MONITORPOWER设置为2。不幸的是,我没有测试能力的计算机,所以我没有尝试过。
我相信,每当您触摸鼠标/键盘时,Windows 都会尝试再次唤醒,但您应该能够捕获这些消息并重新发送 2。
请注意,这尚未经过测试。
You should be able to send a WM_SYSCOMMAND with the SC_MONITORPOWER set to 2. Unfortunately, I am not at a computer with testing abilities, so I haven't tried it out.
I believe that whenever you touch mouse/keyboard, windows tries to wake up again, but you should be able to trap those messages and resend the 2.
Please note that this is not tested.
您可以尝试使用低级键盘和鼠标挂钩(远程桌面应用程序应该已经具备)。确保它是低级别的,即 SetWindowsHookEx(WH_KEYBOARD_LL) 和 SetWindowsHookEx(WH_MOUSE_LL )。
在您的钩子回调函数中:
警告:这将禁用键盘(即使它无法正常工作),直到您的代码调用 CallNextHookEx() 并在回调过程中返回 0。
You could try a low level keyboard and mouse hook (which a remote desktop app should already have). Make sure it is low level i.e. SetWindowsHookEx(WH_KEYBOARD_LL) and SetWindowsHookEx(WH_MOUSE_LL).
Inside your hook callback functions:
WARNING: This WILL disable the keyboard (even if it doesn't work properly) until your code does call CallNextHookEx() and returns 0 in your callback procedures.