Printing images

Developers can print images by using a small series of functions.  First, the PrepareToPrint function must be called to initialize the print settings.  Next, for each image that should be printed, the developer must load the image and then call the PrintDIBPage function.  After calling the PrintDIBPage function, the developer must call the Microsft API’s GlobalUnlock and GlobalFree functions for the image if they no longer need the image.  Once all of the images have been printed, the developer must call the EndPrint function.  The psuedocode below demonstrates how several images can be printed:

PrepareToPrint

 

While some condition

LoadImage

PrintDIBPage

Free the DIB

End While

 

EndPrint