怎样用VB抓图并将其保存在指定的文件里

三楼的你好,请解释下你的代码.你这个只能获取部分窗口图像,我需要的是整个屏幕的,请再写下.谢... 三楼的你好,请解释下你的代码.
你这个只能获取部分窗口图像,我需要的是整个屏幕的,请再写下.
展开
 我来答
290996449
2007-11-14 · 超过31用户采纳过TA的回答
知道答主
回答量:80
采纳率:0%
帮助的人:0
展开全部
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetForegroundWindow Lib "user32" () As Long

Private Sub Command1_Click()
Dim hdc As Long, hWN As Long
Picture1.Width = Screen.Width
Picture1.Height = Screen.Height
Picture1.AutoRedraw = True
hWN = GetForegroundWindow()
hdc = GetDC(hWN)
sx = Screen.Width / Screen.TwipsPerPixelX
sy = Screen.Height / Screen.TwipsPerPixelY
BitBlt Picture1.hdc, 0, 0, sx, sy, hdc, 0, 0, vbSrcCopy
ReleaseDC 0, hdc
Picture1.AutoRedraw = False
SavePicture Picture1.Image, App.Path & "\1.jpg"
End Sub
miss谷谷
2007-11-14 · 超过23用户采纳过TA的回答
知道答主
回答量:88
采纳率:0%
帮助的人:0
展开全部
问那么多次干嘛
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式