VB用API模拟截屏键PrintScreen

很多人用 SendKeys "{PRTSC}" 模拟截屏键 PrintScreen 的时候提示<错误:'70' 拒绝的权限>,于是经常遇到人问...干脆写下来

'声明
Private Declare Sub keybd_event Lib "user32" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_SNAPSHOT = &H2C
'截屏
Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
'设置粘贴板图像为窗体背景
If Clipboard.GetFormat(vbCFBitmap) Then Set Me.Picture = Clipboard.GetData

 

posted @ 2017-07-21 06:31  JustXIII  阅读(1457)  评论(0编辑  收藏  举报