I've been looking at some API's recently, but haven't successfully been able to display a bitmap on a static control. Any ideas how to do it? :confused: my main goal is the easiest way possible to display an image
Printable View
I've been looking at some API's recently, but haven't successfully been able to display a bitmap on a static control. Any ideas how to do it? :confused: my main goal is the easiest way possible to display an image
im basically looking to load a bmp file without using resource files....LoadImage seems to be key, but I don't know where to go from there...can anyone help? :confused:
After load image you have to send the STM_SETIMAGE message to the control. The wParam should be IMAGE_BITMAP and the lParam should be the handle.
Code:HBITMAP hbm = (HBITMAP)LoadImage(NULL, szFileName,
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if(hbm == NULL)
{
// error
}
// SS_BITMAP style must be set for the static control
SendMessage(hwndStatic, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbm);
InvalidateRect(hwndStatic, NULL, TRUE);