DDB example for Visual Basic

This example copies the Lead1 bitmap to the clipboard as a DDB. It pastes the DDB into Lead2 and reverses the image. It then gets a DDB from Lead2, sets the same DDB to Lead1, and repaints.

MousePointer = 11 ' hourglass
MyFlags = COPY_EMPTY + COPY_DDB + COPY_PALETTE
Lead1.Copy MyFlags

If Lead2.Paste(PASTE_ISREADY) = 0 Then
    MsgBox ("Invalid data on the clipboard")
Else
    Lead2.Paste 0
End If

Lead2.Reverse
MyDC = Lead2.GetClientDC
MyDDB = Lead2.GetDDB(MyDC)
MyPalette = Lead2.GetPalette(MyDC)
Lead1.SetDDB MyDC, MyDDB, MyPalette
Lead1.ForceRepaint
Lead2.ReleaseClientDC
MousePointer = 0 ' default