Page 1 of 1

Help with displaying an hBitmap on a canvas

Posted: Fri Mar 01, 2013 2:23 am
by ozzie
Help, please, you Windows API gurus!

I'm using a video playback library that includes a callback event for each frame displayed, and I want to take that frame and display it in a second 'monitor' window which contains little more than a canvas gadget. The callback provides the frame as an hBitmap. How can I copy that image to my canvas gadget? Do I need to use something like BitBlt_?

Re: Help with displaying an hBitmap on a canvas

Posted: Fri Mar 01, 2013 2:28 am
by ts-soft

Code: Select all

StartDrawing(CanvasOutput(#canvas))
  DrawImage(hBitmap, 0, 0)
StopDrawing()

Re: Help with displaying an hBitmap on a canvas

Posted: Fri Mar 01, 2013 2:38 am
by ozzie
Many thanks - works perfectly (after adding the DrawImage Width and Height parameters to rescale the image). Didn't realize the solution would be so simple and standard-PB!