Thread: Waiting for input

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    8

    Waiting for input

    How would I have a program wait for me to press "ctrl+shift+c" or something similar while in another program to execute?

  2. #2
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    "How would I have a program wait for me to press (x) while in another program to execute"...

    Possible interpretations:
    1) You want a program to execute when you press a button in another program
    2) You want your program to suspend itself until a keypress in another application
    3) Some other obscure interpretation

    You seriously have to word your question better. It's sort of unintelligible at the moment.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    119
    One other possible interpretation:

    He wants to make a hotkey to launch his program from anywhere within windows.

    > You seriously have to word your question better. It's sort of unintelligible at the moment.

    Agreed.
    If you speak or are learning Spanish, check out this Spanish and English Dictionary, it is a handy online resource.
    What happens is not as important as how you react to what happens. -Thaddeus Golas

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    8
    Quote Originally Posted by Codulation
    He wants to make a hotkey to launch his program from anywhere within windows.
    That's what I want, sorry for not being more specific.
    Last edited by Jareds411; 09-16-2004 at 05:44 PM.

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Well, I'm not totally sure where hotkey messages are captured from (does the hotkey have to be pressed in the window of the program?), but you could look into RegisterHotKey(). Write a program that calls that at startup, and handles the WM_HOTKEY message by launching your target application (look into CreateProcess(), or less preferably system()). You'll need to know a small amount of Windows API code to do so though.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    Registered User
    Join Date
    Dec 2002
    Posts
    119
    >does the hotkey have to be pressed in the window of the program

    A hotkey is handled at the Windows level and has nothing to do with your program. It's only a way to tell Win. to launch your program.

    BTW, in Win XP in the properties of a shortcut, you can set a hotkey to launch it.
    If you speak or are learning Spanish, check out this Spanish and English Dictionary, it is a handy online resource.
    What happens is not as important as how you react to what happens. -Thaddeus Golas

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 11-21-2009, 01:02 AM
  2. Waiting For A Thread To Idle
    By SMurf in forum Windows Programming
    Replies: 2
    Last Post: 10-10-2008, 06:31 PM
  3. Loop while waiting for input?
    By Terran in forum C++ Programming
    Replies: 6
    Last Post: 05-22-2008, 08:32 PM
  4. simultaneously waiting for data on FIFO and UDP using select call
    By yogesh3073 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-05-2007, 09:53 AM
  5. Getting input without waiting for keypress
    By Ink in forum C Programming
    Replies: 4
    Last Post: 10-01-2004, 01:38 AM