Disferente
Programmer
Is there any way of making a command button look like it is pressed down without using the mouse or any key presses?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[blue]Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const BM_SETSTATE = &HF3
Private Sub Command1_Click()
Command2.SetFocus ' If we want the control outlined and to have the focus rectangle for the full 'pressed' effect
SendMessage Command2.hwnd, BM_SETSTATE, True, 0& ' Down - which is how a COmmand Button is highlighted
Sleep 500 ' Brief pause so we can see button is down
SendMessage Command2.hwnd, BM_SETSTATE, 0&, 0& ' Up - remove highlighting
Command1.SetFocus
End Sub
[/blue]