Results 1 to 2 of 2

Thread: CreateWindowEx -> Button -> BS_ICON?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    31

    Exclamation

    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!

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Send the BM_SETIMAGE messge.

    Info about the messaage
    Code:
    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.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width