Blt Method Example (Compressed/Encrypted Bitmap)

Blt Method Example (Compressed/Encrypted Bitmap)

This example uses a Command Button to display the Bitmap image data from memory onto a Picture Box control on the form. To try the example, you must have a Bitmap file that has been compressed and encrypted with the BitmapUtils object. Place a Command Button and a Picture Box on your form, set the Picture Box's AutoRedraw property to True, and paste the code into your form's module. Then run the example.

Private Sub cmdShowImage_Click()
  Dim strFileName As String
  Dim BMU As VWBitmapUtils.BitmapUtils
  
  'Initialize the BitmapUtils object.
  Set BMU = New VWBitmapUtils.BitmapUtils
  
  strFileName = "C:\WINDOWS\Coffee Bean.enc"
  
  'Load the bytes from the file into memory.
  BMU.LoadByteData(strFileName)
  
  'Decrypt the byte data.
  BMU.DecryptByteData("key")
  
  'Decompress the byte data.
  BMU.DecompressByteData

  'Blt the image from memory to the Picture Box.
  BMU.Blt(Picture1.hDC)
End Sub