Hello. I am working on a BMP viewer and I want it to load a BMP onto a static and set the static control to have the same dimensions as the image. Here's some code:
case IDC_VIEW:
GetWindowText (GetDlgItem(hwnd, IDC_FILE), path, MAX_PATH);
bmpname = (HBITMAP) LoadBitmap (0, path);
GetObject (bmpname, sizeof(bmpinfo), &bmpinfo);
x = bmpinfo.bmWidth;
y = bmpinfo.bmHeight;
bmpname = (HBITMAP) LoadBitmap (0, path);
sX = x;
sY = y;
SendMessage(GetDlgItem(hwnd, IDC_BMP), STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)bmpname);
break;
All of the variables are already declared. The only problem is that it won't display the image on the static control. Can you help me?