I have created 4 ownerdraw buttons as child windows and I am trying to display a bitmap on the buttons.
I believe the correct way of doing this is to use the SendMessage function with the message BM_SETIMAGE. On MSDN it is given as this:
Code:
To send this message, call the SendMessage function as follows.
lResult = SendMessage( (HWND) hWndControl, (UINT) BM_SETIMAGE, (WPARAM) wParam, (LPARAM) lParam );
Parameters:
wParam
Specifies the type of image to associate with the button. This parameter can be one of the following values:
IMAGE_BITMAP
IMAGE_ICON
lParam
Handle to the image to associate with the button.
I have entered IMAGE_BITMAP in as the third argument and as the fourth argument I have used the handle to my bitmap. The problem is that it won't compile stating that the fourth argument should be a long. I tried type casting this argument and it compiled but did not display the bitmap. I believe my method of creating the handle to the bitmap is correct as I have used it elsewhere successfully. Am I doing anything wrong with regards to the use of the SendMessage function?