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;
|