display bitmap on a control botton.
-
Hi there ! Im stuck with my win32 application where I want to add an bitmap to a control button in a dialog., Im tryin to use the BM_SETIMAGE message but I dont get it to work... I have a bitmap IDB_BACKWARD_BITMAP defined in the resource.rc and given an id in resource.h The control button IDC_BUTTON1 that I want to attach the image to is defined in the resource.rc here is my callback function for the dialog window that also contains an combobox etc but its not displayed here. LRESULT CALLBACK ToolboxProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { LRESULT iComboBoxSelection; switch(Msg) { case WM_INITDIALOG: SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, IDB_BACKWARD_BITMAP); .............. I have also tried a version where I load the bitmap like this; Bitmap=LoadBitmap(t_hInst,MAKEINTRESOURCE(IDC_BUTT ON1)); SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, Bitmap); Where I have defined HINSTACE t_hInst global but is there anything else that I have to do with it? and i also get an error "cannot convert parameter 4 from 'BITMAP' to 'LPARAM' ...... Any help would be grateful because I dont have any clue about what to do :) Regrads /Peter
-
Hi there ! Im stuck with my win32 application where I want to add an bitmap to a control button in a dialog., Im tryin to use the BM_SETIMAGE message but I dont get it to work... I have a bitmap IDB_BACKWARD_BITMAP defined in the resource.rc and given an id in resource.h The control button IDC_BUTTON1 that I want to attach the image to is defined in the resource.rc here is my callback function for the dialog window that also contains an combobox etc but its not displayed here. LRESULT CALLBACK ToolboxProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { LRESULT iComboBoxSelection; switch(Msg) { case WM_INITDIALOG: SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, IDB_BACKWARD_BITMAP); .............. I have also tried a version where I load the bitmap like this; Bitmap=LoadBitmap(t_hInst,MAKEINTRESOURCE(IDC_BUTT ON1)); SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, Bitmap); Where I have defined HINSTACE t_hInst global but is there anything else that I have to do with it? and i also get an error "cannot convert parameter 4 from 'BITMAP' to 'LPARAM' ...... Any help would be grateful because I dont have any clue about what to do :) Regrads /Peter
Hi, You can try with another alternative control to avoid more problems: Image Button Control - Codeproject[^] CImageButton - Latindevelopers.com[^] (spanish) use google or altavista to translate. Ivan Cachicatari www.latindevelopers.com