|
-
Oct 10th, 2000, 01:47 PM
#1
Thread Starter
Fanatic Member
How can I set the Command Button's state to clicked/unclicked?
I know I can use the API message WM_LBUTTONDOWN to force the button to "DOWN". That works but if the focus goes to a newly opened form, the button's state has been initialised to "up"...
I wonder why...
-
Oct 10th, 2000, 02:30 PM
#2
Send the BM_SETSTATE message.
Add the following to a Form with 2 CommandButtons.
Code:
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const BM_SETSTATE = &HF3
Private Sub Command1_Click()
PostMessage Command2.hwnd, BM_SETSTATE, 1, 0
End Sub
-
Oct 12th, 2000, 03:18 PM
#3
Thread Starter
Fanatic Member
Nice, Mega, but I really should have found it myself if I was not kind of stupid:
I already used BM_SETSTATE but, I did a copy/paste from some source code on the web and this value was &H4. So that's an error on this site because it means BM_SETSTYLE (sets the border around the button) and not BM_SETSTATE.
That's why it didn't work out.
Thanks again for your reply. Now it works fine.
-
Oct 12th, 2000, 03:21 PM
#4
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|