简单的抓取屏幕生成位图文件(不用内存图象拷贝API函数)
来源:互联网 发布:seo外包公司如何优化 编辑:程序博客网 时间:2024/06/06 22:55
Private Declare Function BitBlt Lib "gdi32" _
(ByVal hDCDest As Long, ByVal XDest As Long, _
ByVal YDest As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal hDCSrc As Long, _
ByVal XSrc As Long, ByVal YSrc As Long, _
ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "USER32" (ByVal hWnd As Long) As Long
Private Declare Function GetWindowRect Lib "USER32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function GetDesktopWindow Lib "USER32" () As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub CaptureScreen()
'定义变量
Dim hcScreen As Long, hwndScreen As Long
Dim SRect As RECT
Dim Width As Long, Height As Long
'先清除
Picture1.AutoRedraw = True '这一句很重要,它用来自动重画持久图形到Picture
Picture1.Picture = LoadPicture()
'获取屏幕句柄
hwndScreen = GetDesktopWindow()
'获取屏幕大小
Call GetWindowRect(hwndScreen, SRect)
Width = SRect.Right - SRect.Left
Height = SRect.Bottom - SRect.Top
'获取屏幕设备上下文句柄
hcScreen = GetDC(hwndScreen)
'粘贴整个屏幕到Picture1中去
Call BitBlt(Picture1.hDC, 0, 0, Width, Height, hcScreen, 0, 0, vbSrcCopy)
'刷新Picture1
Picture1.Refresh
'用SavaPicture来保存图片到指定处,用Image属性(它是保存在内存中的持久图形句柄)
SavePicture Picture1.Image, "C:/My.bmp"
End Sub
- 简单的抓取屏幕生成位图文件(不用内存图象拷贝API函数)
- 拷贝屏幕到位图的函数
- 拷贝对屏幕图象捕获的文章
- 利用Delphi的Tbitmap控件抓取屏幕图象
- 屏幕抓取的简单实现
- 最简单的屏幕拷贝程序(象素拷贝)
- 最简单的屏幕拷贝程序(象素拷贝)
- c++实现文件拷贝,不用system函数
- 不用位图文件的电子钟表
- OPENGL的位图和图象
- 屏幕截图,不用API
- C-不用任何库函数,写一个内存拷贝函数
- windows屏幕抓取的简单源代码
- 生成图象验证码函数
- 生成图象验证码函数
- 生成图象验证码函数
- 不用GD库生成当前时间的PNG格式图象的程序
- MFC 抓取窗口或屏幕位图
- Hibernate
- C语言之指针、数组和函数
- ASP.NET中将数据输出到Excel
- 自定义处理窗体的移动消息WM_MOVE
- 在ASP.NET中从SQL Server检索图片
- 简单的抓取屏幕生成位图文件(不用内存图象拷贝API函数)
- 实现金山快译工具条的自动收缩功能
- java.lang.Byte翻译
- native2ascii-本地码-至-ASCII 码转换器
- 美国人日常生活中常用的五星级句子
- 字符过滤函数
- Entity Bean vs Hibernate Pojo
- 在ASP.NET中如何用C#.NET实现基于表单的验证
- Microsoft Application Blocks for .NET