码迷,mamicode.com
首页 > Windows程序 > 详细

VB用API模拟截屏键PrintScreen

时间:2016-03-21 14:03:30      阅读:649      评论:0      收藏:0      [点我收藏+]

标签:

很多人用 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

  

VB用API模拟截屏键PrintScreen

标签:

原文地址:http://www.cnblogs.com/youyouran/p/5301493.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!