BM_SETSTATE Message

Platforms

Description & Usage

Sending the BM_SETSTATE message changes the pushed state of a button. This message allows you to control whether a button looks pushed down or not. The appearance of the button has no other effect on its state or checked/unchecked value, if applicable. In reality, this message only affects command buttons.

Return Value

The BM_SETSTATE message always returns 0.

Visual Basic-Specific Issues

None.

Parameters

wParam
If this is a non-zero value, the button's appearance is changed to make it looked pushed down. If this is zero, the button's appearance is changed to make it look normal.
lParam
Not used -- set to 0.

Example

Use the BM_SETSTATE message to make button Command1 look pressed down. Do this when the user clicks on button Command2. Obviously, to use this example, you need to make two command buttons named Command1 and Command2 on a form window.

' This code is licensed according to the terms and conditions listed here.

' Declarations and such needed for the example:
' (Copy them to the (declarations) section of a module.)
Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd _
	As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Public Const BM_SETSTATE = &HF4

' *** Place the following code inside the form window. ***
Private Sub Command2_Click()
	Dim retval As Long  ' return value
	
	' Make button Command1 look pressed down.
	retval = SendMessage(Check1.hWnd, BM_SETSTATE, ByVal CLng(1), ByVal CLng(0))
	' That's it!
End Sub

See Also

BM_GETSTATE, BM_SETCHECK

Category

Buttons

Back to the Function list.
Back to the Reference section.


Last Modified: July 30, 2000
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/b/bm_setstate.html