VB 如何获取屏幕图片数据保存在一个二进制数组里面?

VB程序中我会用Open"c:\1.bmp"ForBinaryAs#1读取一个bmp图片文件数据保存在一个二进制数组(Byte数组)中!可是如何获取屏幕图片数据保存在一个... VB程序中我会用Open "c:\1.bmp" For Binary As #1 读取一个bmp图片文件数据保存在一个二进制数组(Byte数组)中!可是如何获取屏幕图片数据保存在一个二进制数组里面?中间不要经过什么图片等控件,直接根据桌面窗口的设备句柄和位图句柄 存储这个二进制数据(Byte数组),要和Open语句读取的数据一样,其中包括文件头信息和图片数据,该怎么实现?我不想先生成BMP图片文件以后再用Open语句读取,请高手不吝赐教!在线等. . . 我QQ271072330 分就这么多了,还请凉解!先谢了!要是分多不够 我可以再给你多加 只要你作的漂亮! 展开
 我来答
匿名用户
2013-10-11
展开全部
'以下就是不经过任何控件直接把截图数据存入数组的代码。分二步: '一、创建一个模块,复制下面代码: Option Explicit Private Type PALETTEENTRY peRed As Byte peGreen As Byte peBlue As Byte peFlags As Byte End Type Private Type LOGPALETTE palVersion As Integer palNumEntries As Integer palPalEntry(255) As PALETTEENTRY End Type Private Type GUID Data1 As Long Data2 As Integer Data3 As Integer Data4(7) As Byte End Type Private Const RASTERCAPS As Long = 38 Private Const RC_PALETTE As Long = &H100 Private Const SIZEPALETTE As Long = 104 Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Long) As Long Private Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Long, _ ByVal nWidth As Long, ByVal nHeight As Long) As Long Private Declare Function GetDeviceCaps Lib "GDI32" (ByVal hDC As Long, ByVal _ iCapabilitiy As Long) As Long Private Declare Function GetSystemPaletteEntries Lib "GDI32" (ByVal hDC As Long, _ ByVal wStartIndex As Long, ByVal wNumEntries As Long, lpPaletteEntries _ As PALETTEENTRY) As Long Private Declare Function CreatePalette Lib "GDI32" (lpLogPalette As LOGPALETTE) _ As Long Private Declare Function SelectObject Lib "GDI32" (ByVal hDC As Long, ByVal hObject _ As Long) As Long 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 DeleteDC Lib "GDI32" (ByVal hDC As Long) As Long Declare Function GetForegroundWindow Lib "user32" () As Long Private Declare Function SelectPalette Lib "GDI32" (ByVal hDC As Long, ByVal hPalette _ As Long, ByVal bForceBackground As Long) As Lon
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式