Unicode Controls & Classes for VB6 - Version 4

clsDIBSection.CloneFromHBmp Method

Creates a DIB section from a bitmap handle, use PictureBox.Picture.Handle if you use VB6 controls

Syntax
Public Sub CloneFromHBmp (ByVal hBmp As Long, _
Optional ByVal bPP As eBppType = bpp_24, _
Optional ByRef cPal As clsPalette = Nothing)
Parameters
Parameter Description
ByVal hBmp As Long The source handle to use
Optional ByVal bPP As eBppType = bpp_24 The desired resolution, pass -1& for using the original image bpp
Optional ByRef cPal As clsPalette = Nothing The palette
Remarks
In this sample we'll countour an image
Option Explicit

Private Sub Form_Click()

Dim oDib As New clsDIBSection
oDib.CloneFromHBmp Image1.Picture.Handle, -1& 'Uses the original bpp

Dim oWrap As New clsCommonWrapper
oWrap.DrawRectCoords oDib.Hdc, 0, 0, oDib.Width, oDib.Height, vbRed, True

oDib.PaintPicture Me.Hdc

End Sub