How to load a bitmap from disk?
-
How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?
use this code... CString fileName = "c:\\pics\\picture.bmp"; // this should be a path to the file to load, can also use CFileDialog to get path // this wil load the image from disk into an HBITMAP HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); CBitmap cBmp; // create a CBitmap to hold the image cBmp.Attach(hBmp); // here is the CBItmap that contains the image ================== The original message was: How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?