Windows API Guide: Advanced API Topics


Platforms

  • Windows 95: Supported.
  • Windows 98: Supported.
  • Windows NT: Requires Windows NT 3.1 or later.
  • Windows 2000: Supported.
  • Windows CE: Requires Windows CE 1.0 or later.

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



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net