binbin003 发表于 2009-1-13 10:20:32

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

我做了一个定时自动截取屏幕的脚本,但是需要操作的时候关闭屏幕显示,以免被别人看到~
有没有那种类似节能模式关闭屏幕的函数~~ 我也担心关闭屏幕之后,截的都是黑屏,呵呵~~
希望大侠们给指导一下,谢谢

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

[ 本帖最后由 binbin003 于 2009-1-17 00:42 编辑 ]

sxd 发表于 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('')
   
    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('')
   
    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

   

binbin003 发表于 2009-1-13 21:16:53

谢了,我研究一下,呵呵~~万分感谢~~

要是奏效的话,我就把帖子改成解决~~嘿嘿

sxd 发表于 2009-1-13 21:25:33

嗯 把id去掉 要低调
被高手们看见丢死人了

kn007 发表于 2009-6-8 19:29:57

好贴,留名
页: [1]
查看完整版本: (感谢!!)我想在屏幕关闭的情况下截屏,如何实现~