2008-11-10 3 views

답변

4
Private Type BITMAP 
    bmType As Long 
    bmWidth As Long 
    bmHeight As Long 
    bmWidthBytes As Long 
    bmPlanes As Integer 
    bmBitsPixel As Integer 
    bmBits As Long 
End Type 

Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long 
Private Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long 

Private Sub GetPictureBytes() 
    Dim PicBits() As Byte, PicInfo As BITMAP 

    GetObject Picture1.Picture, Len(PicInfo), PicInfo 

    ReDim PicBits((PicInfo.bmWidth * PicInfo.bmHeight * 3) - 1) As Byte 

    GetBitmapBits Picture1.Picture, UBound(PicBits), PicBits(0) 
End Sub 
+1

의 샘플 코드를 게시 할 수 있습니까? 그 반대의 경우도 마찬가지이며 propertybag 코드도 게시 할 수 있습니까? – Smith

+0

여기에 물어 보았습니다 http://stackoverflow.com/questions/26442660/loading-a-picturebox-image-from-a-byte-array-in-vb6 –

+0

비트 맵 정보가 아니라 비트 맵 비트 만 검색합니다. 헤더 –

2

VB6에서 작업 한 이후로 오랜 시간이 걸렸으나 이미지를 PropertyBag으로 serialize하고 내용을 바이트 배열로 가져올 수 있습니다.

내가 알고있는 유일한 대안은 동일한 목적을 달성하기 위해 WinAPI를 많이 사용해야한다는 것입니다.

+2

이 – Smith

관련 문제