PDA

Click to See Complete Forum and Search --> : CreateWindowEx -> Button -> BS_ICON?


Darknite2041
Feb 4th, 2001, 05:00 AM
Hey to everyone,

I'm using CreateWindowEx to create a command button on my app. I did this before but I can't remember how the hell!! -> Can someone please tell me how to set an icon for my button?? It just stays blank after I add "BS_ICON" to dwStyles. I believe it has something to do with the SendMessage API but I can't remember what the damn message was, etc, etc... I want my icon to come from a picture box and not loaded from a file.

Thanks! ANY help is GREATLY appreciated!

Vlatko
Feb 4th, 2001, 05:58 AM
Send the BM_SETIMAGE messge.

Info about the messaage

BM_SETIMAGE
An application sends a BM_SETIMAGE message to associate a new image (icon or bitmap) with the button.

BM_SETIMAGE
wParam = (WPARAM) fImageType; // image-type flag
lParam = (LPARAM) (HANDLE) hImage; // handle to the image

Parameters
fImageType
Value of wParam. Specifies the type of image to associate with the button. This parameter can be one of the following values:
IMAGE_BITMAP
IMAGE_ICON

hImage
Value of lParam. Handle to the image to associate with the button.
Return Values
The return value is a handle to the image previously associated with the button, if any; otherwise, it is NULL.