|
-
Jul 1st, 2002, 11:54 PM
#1
PostMessage Key Constants
I am sending messages to other windows using the PostMessage API. For example, I open calc and send it the Ctrl+V message (which is the hotkey for paste). That works OK. The problem comes when I want to send and Alt+something command. I don't know the constants for alt, and they are not in the KeyCodeConstants enum. Please help.
Here is what I have now:
VB Code:
Private Sub Command2_Click()
Dim winhwnd As Long
winhwnd = FindWindow(vbNullString, "calculator")
PostMessage winhwnd, WM_KEYDOWN, vbKeyControl, 0
PostMessage winhwnd, WM_KEYDOWN, vbKeyV, 0
PostMessage winhwnd, WM_KEYUP, vbKeyV, 0
PostMessage winhwnd, WM_KEYUP, vbKeyControl, 0
End Sub
-
Jul 5th, 2002, 10:19 AM
#2
New Member
Const VK_MENU = &H12 'ALT Button
Const VK_LMENU = &HA4 'Specifically Left Alt button
Hope this helps
"If at first you dont succeed, call if version 1.0"
Nickolas
-
Jul 15th, 2002, 07:18 PM
#3
I can't get it to work. I am trying to send menu commands to the calc. It just presses the "E" button on the calculator (in
VB Code:
Private Sub Command2_Click()
Dim winhwnd As Long
winhwnd = FindWindow(vbNullString, "calculator")
PostMessage winhwnd, WM_KEYDOWN, vbKeyMenu, 0
PostMessage winhwnd, WM_KEYDOWN, vbKeyE, 0
PostMessage winhwnd, WM_KEYUP, vbKeyE, 0
PostMessage winhwnd, WM_KEYUP, vbKeyMenu, 0
End Sub
The control button works (like in the first post)
Help Help Help!!!!
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
|