Results 1 to 6 of 6

Thread: Sending keystrokes

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    metairie, la usa
    Posts
    40
    Hi,
    I have a really simple question. Can someone please give me some example code to send CTRL-S to a window. I can get the window handle, I just don't know how to send CTRL combos.

    Thanks,
    RIchard

  2. #2
    Guest
    Use the SendKeys statement.


  3. #3
    Guest
    The Ctrl is represented by ^. Therefor, you can use the following method to send Ctrl+S

    Code:
       AppActivate "MyApp"
       SendKeys "^" + "V"

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    SendKeys( "^s" )

    as I remember

  5. #5
    Guest
    Ha! I forgt to change the V to an S in my example . I was using Notepad to test my code and it doesn't have a Ctrl+S fnction so i changed it to V.

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Use setforegroundwindow instead of using appactivate, as you may not know what youre app's caption is if it's changing, also another apps caption can interfere. And you said you got the handle, all you need is to pass it
    Code:
    Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width