From: DBard on
We're using PostMessage to send a keyboard command to a window. It works
great, until we start needing to send something which requires the control
key.

More specifically:

PostMessage ( handle, WM_KEYDOWN, VK_SPACE, NULL );
send "space" to the window.

How do you send Ctrl-[ or Ctrl-] or Ctrl-P ???

Thanks.
From: AliR on
Take a look at SendInput function.

AliR.

"DBard" <DBard(a)discussions.microsoft.com> wrote in message
news:CB93092B-C7D2-4812-B117-EC7C6B8364FE(a)microsoft.com...
> We're using PostMessage to send a keyboard command to a window. It works
> great, until we start needing to send something which requires the control
> key.
>
> More specifically:
>
> PostMessage ( handle, WM_KEYDOWN, VK_SPACE, NULL );
> send "space" to the window.
>
> How do you send Ctrl-[ or Ctrl-] or Ctrl-P ???
>
> Thanks.


From: DBard on
SendInput send the input data to the active window. I need to send the input
to a different window than the application sending the data, so it doesn't
work for us.



"AliR" wrote:

> Take a look at SendInput function.
>
> AliR.
>
> "DBard" <DBard(a)discussions.microsoft.com> wrote in message
> news:CB93092B-C7D2-4812-B117-EC7C6B8364FE(a)microsoft.com...
> > We're using PostMessage to send a keyboard command to a window. It works
> > great, until we start needing to send something which requires the control
> > key.
> >
> > More specifically:
> >
> > PostMessage ( handle, WM_KEYDOWN, VK_SPACE, NULL );
> > send "space" to the window.
> >
> > How do you send Ctrl-[ or Ctrl-] or Ctrl-P ???
> >
> > Thanks.
>
>
>
From: Joseph M. Newcomer on
You would have to send a WM_KEYDOWN for the control key, followed by the key code you want
to send, followed by a WM_KEYUP for the control key.
joe

On Fri, 18 Mar 2005 10:23:05 -0800, "DBard" <DBard(a)discussions.microsoft.com> wrote:

>We're using PostMessage to send a keyboard command to a window. It works
>great, until we start needing to send something which requires the control
>key.
>
>More specifically:
>
>PostMessage ( handle, WM_KEYDOWN, VK_SPACE, NULL );
>send "space" to the window.
>
>How do you send Ctrl-[ or Ctrl-] or Ctrl-P ???
>
>Thanks.

Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm