I
Interops
Hi,
I am trying to send keys to inactive window of an application.
I use the PostMessage API Call. (http://msdn.microsoft.com/en-us/
library/ms644944(VS.85).aspx)
The key I want to send is the Down Arrow key.
To send i I have to call the PostMessage function with the WM_KEYDOWN
ad WM_KEYUP notifications as parameters to the function
Private Const WM_KEYDOWN As Integer = &H100
Private Const WM_KEYUP As Integer = &H101
Private Const VK_DOWN As Integer = &H28 'Down Arrow
PostMessage(whnd, WM_KEYDOWN, VK_DOWN, lParam)
PostMessage(whnd, WM_KEYUP, VK_DOWN, lParam)
for lParam, I have to use some mumbo-jumbo that I do not understad at
all. I am a weekend programmer wth no math skills at all
ref: (http://msdn.microsoft.com/en-us/library/ms646280(VS.85).aspx)
and (http://msdn.microsoft.com/en-us/library/ms646281(VS.85).aspx)
So far I have found that the keyboard scancode for the Down arrow key
is 0x50
Also I read that I might have to use the following function:
Shared Function MakeLParam(ByVal LoWord As Integer, ByVal HiWord As
Integer) As IntPtr
Return (HiWord << 16) Or (LoWord And &HFFFF)
End Function
The strangest part is that if found a working code, but fo the left
arrow key:
Private Const WM_KEYDOWN As Integer = &H100
Private Const WM_KEYUP As Integer = &H101
Private Const VK_DOWN As Integer = &H25 'Left Arrow
PostMessage(whnd, WM_KEYDOWN, VK_LEFT, &H2F0001)
PostMessage(whnd, WM_KEYUP, VK_LEFT, &H2F0001)
I have no idea where the guy took &H2F0001(3080193) from.
If anyone can help me with this, I will be one very very happy
panda
TIA
I am trying to send keys to inactive window of an application.
I use the PostMessage API Call. (http://msdn.microsoft.com/en-us/
library/ms644944(VS.85).aspx)
The key I want to send is the Down Arrow key.
To send i I have to call the PostMessage function with the WM_KEYDOWN
ad WM_KEYUP notifications as parameters to the function
Private Const WM_KEYDOWN As Integer = &H100
Private Const WM_KEYUP As Integer = &H101
Private Const VK_DOWN As Integer = &H28 'Down Arrow
PostMessage(whnd, WM_KEYDOWN, VK_DOWN, lParam)
PostMessage(whnd, WM_KEYUP, VK_DOWN, lParam)
for lParam, I have to use some mumbo-jumbo that I do not understad at
all. I am a weekend programmer wth no math skills at all
ref: (http://msdn.microsoft.com/en-us/library/ms646280(VS.85).aspx)
and (http://msdn.microsoft.com/en-us/library/ms646281(VS.85).aspx)
So far I have found that the keyboard scancode for the Down arrow key
is 0x50
Also I read that I might have to use the following function:
Shared Function MakeLParam(ByVal LoWord As Integer, ByVal HiWord As
Integer) As IntPtr
Return (HiWord << 16) Or (LoWord And &HFFFF)
End Function
The strangest part is that if found a working code, but fo the left
arrow key:
Private Const WM_KEYDOWN As Integer = &H100
Private Const WM_KEYUP As Integer = &H101
Private Const VK_DOWN As Integer = &H25 'Left Arrow
PostMessage(whnd, WM_KEYDOWN, VK_LEFT, &H2F0001)
PostMessage(whnd, WM_KEYUP, VK_LEFT, &H2F0001)
I have no idea where the guy took &H2F0001(3080193) from.
If anyone can help me with this, I will be one very very happy
panda
TIA