Y0rkieP
February 26th, 2007, 02:55 PM
Hi, Im string to open a window, display test in edit controll and place a bitmap in a static controll, with a close button under it.
ok so I'v created the window, added my edit controll, added the static controll and created the close button - all works so far.
now to adthe image to the static: reading the win32.hlp it shows-
STM_SETIMAGE
wParam = (WPARAM) fImageType; // image-type flag
lParam = (LPARAM) (HANDLE) hImage; // handle of the image
wparam is IMAGE_BITMAP and using resources my image is IDB_IMAGE. on compile all is well, with no errors, my window appears and works - just no image.
my code:
win.cpp - in wm_create
ImgWin = CreateWindow ("static", 0, WS_CHILD | WS_VISIBLE |
SS_BITMAP, 351, 0, 150, 150, hwnd, NULL,
GetModuleHandle(NULL), NULL);
SendMessage(ImgWin,STM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)(HBITMAP)IDB_IMAGE);
in win.h
#define IDB_CLOSE 200 // button identifier
#define IDB_IMAGE 201
in res.rc
IDB_IMAGE BITMAP "c:\\dev-cpp\\examples\\win32testapp\\bg.bmp"
can anyone give me any clues?? thanks :-)
ok so I'v created the window, added my edit controll, added the static controll and created the close button - all works so far.
now to adthe image to the static: reading the win32.hlp it shows-
STM_SETIMAGE
wParam = (WPARAM) fImageType; // image-type flag
lParam = (LPARAM) (HANDLE) hImage; // handle of the image
wparam is IMAGE_BITMAP and using resources my image is IDB_IMAGE. on compile all is well, with no errors, my window appears and works - just no image.
my code:
win.cpp - in wm_create
ImgWin = CreateWindow ("static", 0, WS_CHILD | WS_VISIBLE |
SS_BITMAP, 351, 0, 150, 150, hwnd, NULL,
GetModuleHandle(NULL), NULL);
SendMessage(ImgWin,STM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)(HBITMAP)IDB_IMAGE);
in win.h
#define IDB_CLOSE 200 // button identifier
#define IDB_IMAGE 201
in res.rc
IDB_IMAGE BITMAP "c:\\dev-cpp\\examples\\win32testapp\\bg.bmp"
can anyone give me any clues?? thanks :-)