hwndButton = CreateWindow( "BUTTON", // predefined class "OK", // button text WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON|BS_ICON,//styles // Size and position values are given explicitly, because // the CW_USEDEFAULT constant gives zero values for buttons. 5, // starting x position 5, // starting y position 30, // button width 18, // button height hWnd, // parent window NULL, // No menu (HINSTANCE) GetWindowLong(hWnd,GWL_HINSTANCE), NULL); // pointer not needed // load the icon, NOTE: you should delete it after assigning it. hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_ICON1)); // associate the icon with the button. SendMessage(hwndButton,BM_SETIMAGE,(WPARAM)IMAGE_ICON, (LPARAM)(HANDLE)hIcon);
"BUTTON", // predefined class
"OK", // button text
WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON|BS_ICON,//styles
// Size and position values are given explicitly, because
// the CW_USEDEFAULT constant gives zero values for buttons. 5, // starting x position
5, // starting y position
30, // button width
18, // button height
hWnd, // parent window
NULL, // No menu
(HINSTANCE) GetWindowLong(hWnd,GWL_HINSTANCE),
NULL); // pointer not needed // load the icon, NOTE: you should delete it after assigning it.
hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_ICON1));
// associate the icon with the button.
SendMessage(hwndButton,BM_SETIMAGE,(WPARAM)IMAGE_ICON,
(LPARAM)(HANDLE)hIcon);