
PLEASE HELP!!!!! WinMessage
Hello!
For my application I use number of Command buttons and Label as a Action
Result Display.
According to the customer I have to give him a possibility to activate any
of the command button by press a Key. To do so I would like to use a
Windows message to simulate the button click event . My application looks
like this:
Option Explicit
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
Const WM_LBUTTONDOWN = &HCB
Const WM_LBUTTONUP = &HCB
Private Sub Command1_Click()
Label1.Caption = "Key was Pressed"
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
SendMessage Command1.hwnd, WM_LBUTTONDOWN, 0, 0
SendMessage Command1.hwnd, WM_LBUTTONUP, 0, 0
End Sub
Private Sub Form_Load()
Label1.Caption = ""
Form1.KeyPreview = True
End Sub
But I can not achive the disered result.
PLEASE SOMEBODY HELP ME WITH THIS PROBLEM!!!!
I DO NOT THINK THAT IT IS DIFFICULT FOR SUCH A GURU
Regards,
Alex