General discussion
December 9, 2004 at 03:22 PM
steven_v_brown

Post Message LParam API Question

by steven_v_brown . Updated 19 years, 4 months ago

I have a 3rd party application I am attempting to pass ALT + 1 to.
I used SPY++ to determine what the Keyboard is really sending:
P WM_SYSKEYDOWN nVirtKey: VK_MENU cRepeat:1 ScanCode:38 fExtended:0 fAltDown:1 fRepeat:0 fUp:0 [wParam:00000012 lParam:20380001]
P WM_SYSKEYDOWN ‘nVirtKey: ‘1’ cRepeat:1 ScanCode:02 fExtended:0 fAltDown:1 fRepeat:0 fUp:0 [wParam:00000031 lParam:20020001]
Every time I attempt to PostMessage SPY++ reports the lParam as the following:

P WM_SYSKEYDOWN nVirtKey:VK_MENU cRepeat:64312 ScanCode:12 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000012 lParam:0012FB38]
P WM_SYSKEYDOWN nVirtKey:’1′ cRepeat:64312 ScanCode:12 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000031 lParam:0012FB38]
What is this lParam:0012FB38?
Am I declaring or passing IParam incorrectly?
I would use SendKey or KeyBrd if we were allowed to bring the application into focus on our clients.
Can any one offer help on formatting and having the application use IParam correctly?
‘//Snap of code below…//
Private Declare Function FindWindow _
Lib “user32” Alias “FindWindowA” ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function PostMessage _
Lib “user32” Alias “PostMessageA” ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) _
As Long
Private Const WM_SYSKEYDOWN As Long = &H104
Private Const WM_SYSKEYUP As Long = &H105
Private Const VK_MENU As Long = &H12
Sub Main()
Call Test
End Sub
Sub test()
Dim hwnd As Long
Dim sWnd As String
Dim lRet As Long
Dim lParam As Long
Dim wParam As Byte
sWnd = “Call Agent”
hwnd = FindWindow(vbNullString, sWnd)
If hwnd Then
wParam = &H12
lParam = &H1
lParam = 0
lParam = &H20001001
lRet = PostMessage(hwnd, WM_SYSKEYDOWN, wParam, lParam)
Beep
end if
end sub
‘Steven V. Brown,
‘sbrown2@humana.com

This discussion is locked

All Comments