VBA保存剪贴板为Bmp(加PrtScrn截屏)
时 间:2011-10-09 07:40:55
作 者:dbaseIIIer ID:22003 城市:深圳
摘 要:截屏只是模拟了键盘的 {PrtScrn} 及 %{PrntScrn} 未能做到范围的!
不过保存 bmp 是异常的快!
值得保留,学习的!
尤其是要做些逐个像素处理的工作,
例如
破解登入图像的验证码,
十字绣转换软件,
excel的电影播放器等!
bmp 无疑是最好的选择!
正 文:
Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As Long
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
Private Const CF_BITMAP = 2
Private Type PicBmp
Size As Long
type As Long
hBmp As Long
hpal As Long
Reserved As Long
End Type
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Sub My_Screen_1()
Call keybd_event(vbKeySnapshot, 0, 0, 0)
DoEvents
End Sub
Private Sub My_Screen_2()
Call keybd_event(vbKeySnapshot, 1, 1, 1)
DoEvents
End Sub
Sub Scheduled_Snapshot()
Dim Pic As PicBmp, IPic As IPicture, IID_IDispatch As GUID
Call My_Screen_2
oTime = Now()
OpenClipboard 0
With Pic
.Size = Len(Pic)
.type = 1
.hBmp = GetClipboardData(CF_BITMAP)
End With
OleCreatePictureIndirect Pic, IID_IDispatch, 1, IPic
stdole.SavePicture IPic, "d:\snapshot_" & Format(Now(), "yyyy-mm-dd hhnnss") & ".bmp"
CloseClipboard
End Sub
Access软件网QQ交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
- 【Access选项卡示例】Ac...(09.09)
学习心得
最新文章
- Access系统自带的日期选择器不...(11.08)
- 分享一下Access工程中的acw...(11.07)
- Access快速开发平台--让有权...(11.04)
- Access快速开发平台--审批选...(11.01)
- ACCESS两张表先各自排序,然后...(10.31)
- Access对子窗体数据进行批量+...(10.30)
- SqlServer中如何用SQL命...(10.29)
- Access报表中的分组功能用代码...(10.28)
- 用Access计算库存结余的一个方...(10.26)
- 最精简的组合框行来源数据快速输入(...(10.25)