找回密码
 加入
搜索
查看: 2370|回复: 4

(感谢!!)我想在屏幕关闭的情况下截屏,如何实现~

[复制链接]
发表于 2009-1-13 10:20:32 | 显示全部楼层 |阅读模式
我做了一个定时自动截取屏幕的脚本,但是需要操作的时候关闭屏幕显示,以免被别人看到~  
有没有那种类似节能模式关闭屏幕的函数~~ 我也担心关闭屏幕之后,截的都是黑屏,呵呵~~
希望大侠们给指导一下,谢谢

PS:我的脚本流程: 判断时间如果符合,进入截屏操作,打开相应软件,调整到对应窗口进行截屏,然后自动退出~
~!!!重点: 我要在笔记本上完成上述操作,但是目前的脚本无法提供这样的功能。
我在autoitscript论坛上看了更新的帖子,用了新的脚本,但是,虽然可以关闭屏幕,但是不能有任何键盘或鼠标操作 ~~,无法达到目的~~
台式机和笔记本在能源管理上是不是有不同,在操作系统里是否可以更改以达到目的;
user32.dll 有没有别的用法 ,呵呵~~很好奇, 偶不是专业 编程滴~~

[ 本帖最后由 binbin003 于 2009-1-17 00:42 编辑 ]
发表于 2009-1-13 15:58:19 | 显示全部楼层
显示器关否 只是一个显示设备的开关 截图不会是黑的呢

在官方论坛找到个 显示器开关的例子 你参考下把

不过没研究过 lcd和crt显示器会不会有不同
Global Const $lciWM_SYSCommand = 274
Global Const $lciSC_MonitorPower = 61808
Global Const $lciPower_Off = 2
Global Const $lciPower_On = -1

Global $MonitorIsOff = False

HotKeySet("{F11}", "_Monitor_OFF")
HotKeySet("{F10}", "_Monitor_ON")
HotKeySet("{Esc}", "_Quit")

MsgBox(64, "Monitor On/Off", "Press F11 to turn off the monitor." & @LF & _
                            "Press F10 to turn on the monitor back." & @LF & _
                            "Press ESC to turn on the monitor and exit program.")

While 1
    Sleep(10)
WEnd

Func _Monitor_ON()
    $MonitorIsOff = False
    Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')
    
    DllCall('user32.dll', 'int', 'SendMessage', _
                                                'hwnd', $Progman_hwnd, _
                                                'int', $lciWM_SYSCommand, _
                                                'int', $lciSC_MonitorPower, _
                                                'int', $lciPower_On)
EndFunc

Func _Monitor_OFF()
    $MonitorIsOff = True
    Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')
    
    While $MonitorIsOff = True
        DllCall('user32.dll', 'int', 'SendMessage', _
                                                    'hwnd', $Progman_hwnd, _
                                                    'int', $lciWM_SYSCommand, _
                                                    'int', $lciSC_MonitorPower, _
                                                    'int', $lciPower_Off)
        _IdleWaitCommit(0)
        Sleep(20)
    WEnd
EndFunc

Func _IdleWaitCommit($idlesec)
    Local $iSave, $LastInputInfo = DllStructCreate ("uint;dword")
    DllStructSetData ($LastInputInfo, 1, DllStructGetSize ($LastInputInfo))
    DllCall ("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr ($LastInputInfo))
    Do
        $iSave = DllStructGetData ($LastInputInfo, 2)
        Sleep(60)
        DllCall ("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr ($LastInputInfo))
    Until (DllStructGetData ($LastInputInfo, 2)-$iSave) > $idlesec Or $MonitorIsOff = False
    Return DllStructGetData ($LastInputInfo, 2)-$iSave
EndFunc

Func _Quit()
    _Monitor_ON()
    Exit
EndFunc
 
    

评分

参与人数 1贡献 +2 收起 理由
lynfr8 + 2 好东西

查看全部评分

 楼主| 发表于 2009-1-13 21:16:53 | 显示全部楼层
谢了,我研究一下,呵呵~~万分感谢~~

要是奏效的话,我就把帖子改成解决~~嘿嘿
发表于 2009-1-13 21:25:33 | 显示全部楼层
嗯 把id去掉 要低调
被高手们看见丢死人了
发表于 2009-6-8 19:29:57 | 显示全部楼层
好贴,留名
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-23 03:21 , Processed in 0.078477 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表