JustinEzequiel
Programmer
Greetings helpful people,
We use a console (DOS) program that we can only access via Remote Desktop.
Since we already have (database) the data to input into the said remote console program, I was asked if I could automate the data entry.
(database is appended to daily)
I can get at the 'IHWindowClass' child window of the 'TSSHELLWND' parent window via FindWindow/FindWindowEx.
But PostMessage(cw, WM_CHAR, 65, 0), which works for local windows, is ignored by the IHWindowClass window.
What I found that works is
SendMessage(cw, WM_KEYDOWN, 0x00000041, 0x001E0001)
SendMessage(cw, WM_CHAR, 0x00000061, 0x001E0001)
SendMessage(cw, WM_KEYUP, 0x00000041, 0xC01E0001)
This works if I want to send the letter 'a'
My question is, how do I calculate lParam for any other character I wish to enter?
Currently, I'll be spying on messages and putting these into a lookup table.
Is there a simpler method?
WM_KEYDOWN nVirtKey:'A' cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000041 lParam:001E0001]
WM_CHAR chCharCode:'0061' (97) cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000061 lParam:001E0001]
WM_KEYUP nVirtKey:'A' cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:1 fUp:1 [wParam:00000041 lParam:C01E0001]
WM_KEYDOWN nVirtKey:'B' cRepeat:1 ScanCode:30 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000042 lParam:00300001]
WM_CHAR chCharCode:'0062' (98) cRepeat:1 ScanCode:30 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000062 lParam:00300001]
WM_KEYUP nVirtKey:'B' cRepeat:1 ScanCode:30 fExtended:0 fAltDown:0 fRepeat:1 fUp:1 [wParam:00000042 lParam:C0300001]
We use a console (DOS) program that we can only access via Remote Desktop.
Since we already have (database) the data to input into the said remote console program, I was asked if I could automate the data entry.
(database is appended to daily)
I can get at the 'IHWindowClass' child window of the 'TSSHELLWND' parent window via FindWindow/FindWindowEx.
But PostMessage(cw, WM_CHAR, 65, 0), which works for local windows, is ignored by the IHWindowClass window.
What I found that works is
SendMessage(cw, WM_KEYDOWN, 0x00000041, 0x001E0001)
SendMessage(cw, WM_CHAR, 0x00000061, 0x001E0001)
SendMessage(cw, WM_KEYUP, 0x00000041, 0xC01E0001)
This works if I want to send the letter 'a'
My question is, how do I calculate lParam for any other character I wish to enter?
Currently, I'll be spying on messages and putting these into a lookup table.
Is there a simpler method?
WM_KEYDOWN nVirtKey:'A' cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000041 lParam:001E0001]
WM_CHAR chCharCode:'0061' (97) cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000061 lParam:001E0001]
WM_KEYUP nVirtKey:'A' cRepeat:1 ScanCode:1E fExtended:0 fAltDown:0 fRepeat:1 fUp:1 [wParam:00000041 lParam:C01E0001]
WM_KEYDOWN nVirtKey:'B' cRepeat:1 ScanCode:30 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000042 lParam:00300001]
WM_CHAR chCharCode:'0062' (98) cRepeat:1 ScanCode:30 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000062 lParam:00300001]
WM_KEYUP nVirtKey:'B' cRepeat:1 ScanCode:30 fExtended:0 fAltDown:0 fRepeat:1 fUp:1 [wParam:00000042 lParam:C0300001]