1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
//--RESOURCES.RC--
#define MYBITMAP "mybitmap.bmp"
//--RESOURCES.H--
#define MYBITMAP 101
#define CONTAINER 201
#define PICTURE 202
//--MAIN.CPP--
HWND container, picture;
BITMAP mybitmap;
//--I am trying to apply the bitmap inside the WM_CREATE message
case WM_CREATE:
// This is a STATIC that contains the STATIC that displays the image
container = CreateWindowEx(
0,
"STATIC",
NULL,
WS_CHILD|WS_VISIBLE,
5, 21, 190, 180,
hWnd,
(HMENU)CONTAINER,
hInstance,
NULL
);
// This is the STATIC that contains the image
picture = CreateWindowEx(
0,
"STATIC",
NULL,
WS_CHILD|WS_VISIBLE|SS_BITMAP,
100, 30, 100, 100,
container,
(HMENU)PICTURE,
hInstance,
NULL
);
mybitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(MYBITMAP));
SendDlgItemMessage(container, PICTURE, STM_SETIMAGE, (WPARAM)MYBITMAP, (LPARAM)mybitmap);
break;
|