Sending keystrokes to window?(PLEASE ANSWER!)

This is a discussion on Sending keystrokes to window?(PLEASE ANSWER!) within the Windows Programming forums, part of the Platform Specific Boards category; You can read my past 2 post, about the Window Manager. I have a question. How do I make an ...

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb Sending keystrokes to window?(PLEASE ANSWER!)

    You can read my past 2 post, about the Window Manager. I have a question. How do I make an AOL Instant Messenger window type the text in an edit box from my program? It's not homework! I do self-created projects. I'm just really curious so please help! I know how to get a button click, too. When the user clicks the send button, how do I make an Instant Message window type the stuff in the EDIT box?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hi,

    Firstly you need to get a handle to the edit box in AOL IM, The best way to find a handle is buy Using FindWindow().

    Once you have a handle simply send it the WM_CHAR msg with wParam containg the value of the keys that you want to be displayed.

    Once AIM has recived this message it should display them automaticall, aslong as it was not created with a resource.

    Code:
    //second param = window title
    HWND hWndAim = FindWindow(0, "AOL Instant Messenger");
    
    if(hWndAim != NULL)
    {
    SendMessage(hWnd, WM_CHAR, wParam, lParam);
    }
    wParam Specifies the character code of the key.

    That should be possible to adapt to work, i think anyway... as long as its not in VB which it may be.

    Thanks
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  3. #3
    Caffienated jinx's Avatar
    Join Date
    Oct 2001
    Posts
    235

    Hey, another prog

    Hey SyntaxBubble, I see that you are making somehting that is similiar to a aim prog. Good Job.
    Weeel, itss aboot tieme wee goo back too Canada, eeehy boyss.

  4. #4
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Read this...

    Thanks, jinx. Anyhow, (TNT), does the WM_CHAR message have to send a seingle character at a time? Because I don't think it's working right.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  5. #5
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hi,

    Yes WM_CHAR does deal with single key strokes. But you should be able to set up a loop to display a string, character by character in the other application.

    There may well be a better way of doing this, this is just what came to mind.


    Code:
    char str[100] = "Display";
    for(int i = 0; i < 7; i++)
    {
    //go through every letter in str and send it individually to aim.
    
    }

    Hope that helps
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  6. #6
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Could you...

    Ok, now say the screenname to send to is "abc_123", I use GetWindowText(); to get my edit box text, which is what to send. Could you post a code to how you would send them?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getting weird answer when not using ".h"
    By CobraCC in forum C++ Programming
    Replies: 10
    Last Post: 05-07-2003, 07:21 AM
  2. simple answer? test your IQ
    By Fountain in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 07-11-2002, 05:32 PM
  3. I still have some problems
    By Mike Jones in forum C Programming
    Replies: 2
    Last Post: 04-01-2002, 02:26 AM
  4. code help :)
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 02-28-2002, 01:12 PM
  5. Replies: 22
    Last Post: 11-08-2001, 11:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21