BM_SETIMAGE not working

As I see in a lot of tutorials and forums, BM_SETIMAGE should be a piece of cake, but this is C++ (and Windows), so anything can happen. I have this code:
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
//Resources.rc
BITMAP1        BITMAP      "bitmap1.bmp" //16x16px

//Resources.h
#define        BITMAP1     101

#define        MYBUTTON    201

//Main.cpp - inside the WM_CREATE
HWND mybutton;
HBITMAP bitmap1;
//
// WinMain and other stuff that works great
//
case WM_CREATE:
     mybutton = CreateWindowEx(
               WS_EX_CLIENTEDGE,
               "BUTTON",
               "mybutt",
               WS_VISIBLE|WS_CHILD|BS_BITMAP,
               0,
               0,
               24,
               24,
               hWnd,
               (HMENU)MYBUTTON,
               hInstance,
               NULL);
     
     bitmap1 = LoadBitmap(hInstance, MAKEINTRESOURCE(BITMAP1));
     SendMessage(mybutton, BM_SETIMAGE, BITMAP1, (LPARAM)bitmap1 );
break;


Not only the text doesn't appear on the button but the image either is shown. I feel like I am missing something again, or maybe is my O.S.
Last edited on
Your send message is not right - It should be:
SendMessage(mybutton, BM_SETIMAGE, IMAGE_BITMAP,(LPARAM)bitmap1 )
Last edited on
Topic archived. No new replies allowed.