DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: SendMessage and SendKeys

  1. #1
    Lee Clements Guest

    SendMessage and SendKeys


    I want to be able to post keystrokes to a specific window, but I do not want
    to use the VB function SendKeys, as the window may not always be active and
    I am not allowed to make it the active window using AppActivate.

    Can anyone tell me how to use the SendMessage API to do this, assuming that
    I already have the window handle.

    Thanks in advance.

    Cheers
    Lee

  2. #2
    Michael Shutt Guest

    Re: SendMessage and SendKeys

    You can use the PostMessage function with WM_KEYDOWN/WM_KEYUP and
    WM_SYSKEYDOWN/WM_SYSKEYUP messages to do this.

    Sending a WM_KEYDOWN followed by a WM_KEYUP will simulate a keypress in the
    recieving window. I had to use Spy to figure out some of the paramters and
    which windows really receive the events.

    "Lee Clements" <lee_clements@checkmate.com> wrote in message
    news:3a670dfb$1@news.devx.com...
    >
    > I want to be able to post keystrokes to a specific window, but I do not

    want
    > to use the VB function SendKeys, as the window may not always be active

    and
    > I am not allowed to make it the active window using AppActivate.
    >
    > Can anyone tell me how to use the SendMessage API to do this, assuming

    that
    > I already have the window handle.
    >
    > Thanks in advance.
    >
    > Cheers
    > Lee




  3. #3
    Michael Shutt Guest

    Re: SendMessage and SendKeys

    You can use the PostMessage function with WM_KEYDOWN/WM_KEYUP and
    WM_SYSKEYDOWN/WM_SYSKEYUP messages to do this.

    Sending a WM_KEYDOWN followed by a WM_KEYUP will simulate a keypress in the
    recieving window. I had to use Spy to figure out some of the paramters and
    which windows really receive the events.

    "Lee Clements" <lee_clements@checkmate.com> wrote in message
    news:3a670dfb$1@news.devx.com...
    >
    > I want to be able to post keystrokes to a specific window, but I do not

    want
    > to use the VB function SendKeys, as the window may not always be active

    and
    > I am not allowed to make it the active window using AppActivate.
    >
    > Can anyone tell me how to use the SendMessage API to do this, assuming

    that
    > I already have the window handle.
    >
    > Thanks in advance.
    >
    > Cheers
    > Lee




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center