这是我用vb写的. 跟C++差不多的调用方式 当成C++看吧不多说了 直接上代码吧, 问题如题目 返回值是个0 成功不是返回高么,就是线条数.一直返回为0 找找出错原因吧.谢了. hbmp = LoadImage(vbNull, "C:\123.bmp", 0, 0, 0, &H10 Or &H2000)
GetObject hbmp, Len(PathBMP), PathBMP PathWidth = PathBMP.bmiHeader.biWidth
PathHeight = PathBMP.bmiHeader.biHeight PathBMP.bmiHeader.biSize = Len(PathBMP.bmiHeader)
PathBMP.bmiHeader.biWidth = PathWidth
PathBMP.bmiHeader.biHeight = -PathHeight
PathBMP.bmiHeader.biBitCount = 32
PathBMP.bmiHeader.biPlanes = 1
'///////////////////////////////////////
ReDim PathArray(3, PathWidth - 1, PathHeight - 1) As Byte '// 定义数组范围
DC = GetWindowDC(0) Dim ret As Long
ret = GetDIBits(DC, hbmp, 0, PathHeight, PathArray(0, 0, 0), PathBMP, 0) '// 开始读取数据
Dim hdc As Long
hdc = GetDC(0)
Dim hdcMem As Long
hdcMem = CreateCompatibleDC(hdc)
SelectObject hdcMem, hbmp
GetObject hbmp, Len(PathBMP), PathBMP
BitBlt hdc, 0, 0, PathBMP.bmiHeader.biWidth, PathBMP.bmiHeader.biHeight, hdcMem, 0, 0, &HCC0020这样写也是0 但是这个图能成功的绘制出来....