最新消息:

NsScreenshot是NSIS获取屏幕快照截图并保存成bmp格式的插件

nsis 永恒心锁 2334浏览 0评论
/*
NsScreenshot是NSIS获取屏幕快照截图并保存成bmp格式的插件
NsScreenshot提供两个方式的截屏操作,一是全屏幕截取,二是截取指定的窗口,比如Push $HWNDPARENT进栈就可以截取当前安装程序的画面.
*/
!AddPluginDir "."
Name "nsScreenshot Test"
OutFile "nsScreenshot Test.exe"
ShowInstDetails show
Section "Make Screenshot"
 DetailPrint "nsScreenshot example by Leon Zandman"
 DetailPrint "------------------------------------"
 ; ----------- Full-screen screenshot ----------------
 ; Put filename of screenshot onto stack
 StrCpy $0 "$EXEDIRFullscreen_Screenshot.bmp"
 Push $0
; Capture full screen
 nsScreenshot::Grab_FullScreen
 ; $1 contains "ok" if the screenshot was taken
 ; $1 contains "error" if something went wrong
 Pop $1
 StrCmp $1 "ok" ok1 0
 DetailPrint "FullScreen screenshot error"
 Goto next1
ok1:
 ; Pop image dimensions from stack (only available when plugin returned "ok")
 Pop $R1
 Pop $R2
 DetailPrint "Fullscreen screenshot saved as: $0"
 DetailPrint " Dimensions: ($R1x$R2)"
next1:
 ; ----------- NSIS window screenshot ----------------
 ; Put window handle of NSIS screen onto stack
 Push $HWNDPARENT
 ; Put filename of screenshot onto stack
 StrCpy $0 "$EXEDIRNSIS_Screenshot.bmp"
 Push $0
 ; Capture NSIS window
 nsScreenshot::Grab
 Pop $1
 ; $1 contains "ok" if the screenshot was taken
 ; $1 contains "error" if something went wrong
 StrCmp $1 "ok" ok2 0
 DetailPrint "NSIS screenshot error"
 Goto next2
ok2:
 ; Pop image dimensions from stack (only available when plugin returned "ok")
 Pop $R1
 Pop $R2
 DetailPrint "NSIS screenshot saved as: $0"
 DetailPrint " Dimensions: ($R1x$R2)"
next2:
 ; ----------- Taskbar screenshot ----------------
 ; Put window handle of taskbar window onto stack
 FindWindow $R0 "Shell_TrayWnd"
 Push $R0
 ; Put filename of screenshot onto stack
 StrCpy $0 "$EXEDIRTaskbar_Screenshot.bmp"
 Push $0
; Capture Taskbar window
nsScreenshot::Grab
 Pop $1
 ; $1 contains "ok" if the screenshot was taken
 ; $1 contains "error" if something went wrong
 StrCmp $1 "ok" ok3 0
 DetailPrint "System Tray screenshot error"
 Goto next3
ok3:
 ; Pop image dimensions from stack (only available when plugin returned "ok")
 Pop $R1
 Pop $R2
 DetailPrint "Taskbar screenshot saved as: $0"
 DetailPrint " Dimensions: ($R1x$R2)"
next3:
 ; ----------- Tray screenshot ----------------
 ; Put window handle of taskbar window onto stack
 ; Notice the second call to FindWindow, needed because it's a child window
 FindWindow $R0 "Shell_TrayWnd"
 FindWindow $R0 "TrayNotifyWnd" "" $R0
 Push $R0
 ; Put filename of screenshot onto stack
 StrCpy $0 "$EXEDIRTray_Screenshot.bmp"
 Push $0
; Capture Taskbar window
nsScreenshot::Grab
 Pop $1
 ; $1 contains "ok" if the screenshot was taken
 ; $1 contains "error" if something went wrong
 StrCmp $1 "ok" ok4 0
 DetailPrint "Tray screenshot error"
 Goto next4
ok4:
 ; Pop image dimensions from stack (only available when plugin returned "ok")
 Pop $R1
 Pop $R2
 DetailPrint "Tray screenshot saved as: $0"
 DetailPrint " Dimensions: ($R1x$R2)"
next4:
SectionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » NsScreenshot是NSIS获取屏幕快照截图并保存成bmp格式的插件

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址