VB截取当前屏幕并保存为24位Bmp图片,VB截取屏幕并保存为24位Bmp图片,VB截取屏幕保存为24位Bmp图片,VB截取屏幕保存为Bmp图片,VB截取屏幕保存为图片,VB截取屏幕存为24位Bmp图片,VB截取屏幕存为Bmp图片,VB截取屏幕并存为图片,VB截取当前屏幕,VB截取屏幕保存为24位Bmp图片,VB截取屏幕,VB截取屏幕存为24位Bmp,VB GetDC,GetDC,VB BitBlt,BitBlt。

VB截取当前屏幕并保存为Bmp图片:

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 '获取图片数据

Me.BorderStyle = 2 '窗体风格,否则截取不全
Me.AutoRedraw = True '开启自动重绘
BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, GetDC(0), 0, 0, vbSrcCopy '获取屏幕数据
'SavePicture Me.Image, "c:\a.bmp" '保存为图片,覆盖模式