BitBlt BigPallete.hDC, X * 300, Y * 300, 300, 300, Temp2.hDC, 0, 0, SRCCOPY
Private Declare Function OleCreatePictureIndirect Lib "oleaut32" (ByRef lpPictDesc As PicBmp, riid As GUID, ByVal fOwn As Long, ByRef lplpvObj As Any) As Long
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Type PicBmp
Size As Long
Type As PictureTypeConstants
hBmp As Long
hPal As Long
Reserved As Long
End Type
Public Function GetPicture(ByVal hPic as long) As IPictureDisp
Dim p As PicBmp, g As GUID
With p
.hBmp = hPic
.Size = Len(p)
.Type = vbPicTypeBitmap
End With
With g
.Data1 = &H20400
.Data4(0) = &HC0
.Data4(7) = &H46
End With
OleCreatePictureIndirect p, g, 0, GetPicture
End Function
SavePicture GetPicture(hBitmap), "pathtofile"
Public Function CreateFromBMP24(ByVal FN As String, ByRef Spr() As Byte, ByRef W As Integer, ByRef H As Integer, Optional Pos As Long = 1)
Dim F As Long, T As Long, B As Byte
Dim BFH As BITMAPFILEHEADER, bih As BITMAPINFOHEADER
F = FreeFile
Open FN For Binary Access Read As #F
Get #F, Pos, BFH
Get #F, Pos + Len(BFH), bih
If Not bih.biBitCount = 24 Then GoTo Erro
W = bih.biWidth
H = bih.biHeight
ReDim Spr(1 To RGBWidth(W), 1 To H) As Byte
Get #F, Pos + Len(BFH) + Len(bih), Spr()
Erro:
Close #F
End Function
Сейчас этот форум просматривают: Google-бот и гости: 192