How to make a button control appear down, or a refference to all WM_x msgs

Started by *DEAD*, December 19, 2007, 08:25:41 AM

Previous topic - Next topic

*DEAD*

Hi, i have a dialog with a button, but when your press the button i want it to appear as though its stuck down, and then when you press it again it appears up again. Now i only made my first dialog yesterday, but from what i can gather a message is sent to the dialog using
invoke SendDlgItemMessage,
such as WM_SETTEXT which is used in the example. Even better would be where to find a reference to all messages which can be sent to controls. Searching the internet i could only find a few on the msdn website.
Thanks.

zooba

You actually need to specify some different styles for this case. Look up "Button Styles" on MSDN - it really is the best source of this information.

The styles you will need on your button are BS_AUTOCHECKBOX and BS_PUSHLIKE. The first will make the button toggle on and off and the second will make it look like a regular button.

Cheers,

Zooba :U

ramguru

Quote from: *DEAD* on December 19, 2007, 08:25:41 AM
Hi, i have a dialog with a button, but when your press the button i want it to appear as though its stuck down, and then when you press it again it appears up again
You should send BM_SETSTATE message (when you receive WM_COMMAND msg) that will do the thing (works with BS_PUSHBUTTON style)

*DEAD*

and how do u guys no that have u just been doing this way too long, or is it all on msdn if u know where to look?
thx for the help

EDIT one more thing, when u use BM_SETSTATE what params do you have to send with it.
Another thing, it would seem as if the dialog editor in WinAsm doest have those styles in the style properties. Does this mean this type of button can only be created at run time?

TNick

There is also an help file (Win32.hlp) that has references about this sort of things. You may hunt it on net if you don't have a good connection and/or don't want to spend all your time searching MSDN. I would recommend to follow Iczelion's excelent tutorials.

BM_SETSTATE... let's see: open a new tab in Mozilla, write "BM_SETSTATE" in google search bar, press "ENTER" and... look, some results here. Let's use the first one:
QuoteBM_SETSTATE Message ()
BM_SETSTATE Message. Sets the highlight state of a button. The highlight state indicates whether the button is highlighted as if the user had pushed it. ...
msdn2.microsoft.com/en-us/library/bb761823.aspx - 10k - ...

we should now follow the link... would you look at that: some links at the top, BM_SETSTATE Message twice, something about language...
QuoteParameters

    wParam
        Specifies whether the button is highlighted. A value of TRUE highlights the button. A value of FALSE removes any highlighting.
    lParam
        Not used.

What a great thing internet is ...
Nick

Jimg

QuoteAnother thing, it would seem as if the dialog editor in WinAsm doest have those styles in the style properties. Does this mean this type of button can only be created at run time?
Those styles are available on the checkbox item in the toolbox.  Not obvious for a first time user, I'll admit.

*DEAD*

Jimg, thx a million, i would have never figured that out without you