SendKeys - PostMessage problem

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi all.

Probably a quick one, I'm using PostMessage to send keys to an applicatoin
but how do I convert the key string to a long values so that I can pass this
to the wParam. The definition is below

Private Declare Auto Function PostMessage Lib "user32" ( _
ByVal hWnd As IntPtr, _
ByVal Msg As Integer, _
ByVal wParam As Long, _
ByVal lParam As Long) As Boolean

This works -> PostMessage(myWindow, WM_KEYDOWN, Keys.X, 0)

However I need to somehow convert the stirng into the equiv keycodes so I
can do something like

PostMessage(myWindow, WM_KEYDOWN, "x", 0)



Thanks
Paul
 
* "Paul said:
Probably a quick one, I'm using PostMessage to send keys to an applicatoin
but how do I convert the key string to a long values so that I can pass this
to the wParam. The definition is below

Private Declare Auto Function PostMessage Lib "user32" ( _
ByVal hWnd As IntPtr, _
ByVal Msg As Integer, _
ByVal wParam As Long, _
ByVal lParam As Long) As Boolean

Replace the 'Long' with 'Int32' and pass 'Asc("X")' (untested!).

BTW: Please post only to groups related to your problem!
 
Back
Top