SendInput()?

This is a discussion on SendInput()? within the Windows Programming forums, part of the Platform Specific Boards category; I've looked up API for SendInput(); and I don't really think this is what I'm looking for. I have two ...

  1. #1
    src
    src is offline
    Registered User
    Join Date
    Feb 2003
    Posts
    7

    SendInput()?

    I've looked up API for SendInput(); and I don't really think
    this is what I'm looking for.

    I have two processes running.
    1. Some windows App.
    2. My programmed app.

    I would like my programmed app to send a string of text
    to a window app.

    Is SendInput() the only way to do this?
    SendInput will only allow one VK_CHAR at at time.

    Any other way besides COM+.
    I would like to stick to Win32 API if possible

    Thanks

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    if you know the hwnd of the window you want to "send text to" you can do a PostMessage() to it. depending on what you want the results to be you will have to know how the window responds to the given message.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    src
    src is offline
    Registered User
    Join Date
    Feb 2003
    Posts
    7
    But PostMessage only send WM_messages
    ie: WM_CLOSE etc

    I need to send an actual char *msg = "blehbleh";

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    um, buddy, I think you're confused. Are you talking about a windows msg (WM_WHATEVER) or something completely defferent?

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by src
    But PostMessage only send WM_messages
    ie: WM_CLOSE etc

    I need to send an actual char *msg = "blehbleh";
    It seems to me that you are not simply se3nding text to an app....but you also want to add text to the display......(just like as I am adding text to this edit box by typing the keys on my keyboard)

    If this is the case, and the control you want to add text to is an edit or rich edit, you should find the handle to the actual control (not the main window) and add text with a WM_SETTEXT message......if its something else entirely like MSWord, then perhaps you could simulate keystrokes with messages to fake keypresses.

    Either way, try get Spy++ (it comes with VC++). This tool allows you to lookup control and window handles and inject a hook into them to see what messages are posted to a window

  6. #6
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Originally posted by src
    But PostMessage only send WM_messages
    ie: WM_CLOSE etc

    I need to send an actual char *msg = "blehbleh";
    look up WM_COPYDATA. This should solve your problem
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  7. #7
    fou
    Guest
    See this page under PUSHKEYS. This is a port of the vb statement sendkeys in C.
    http://wwwthep.physik.uni-mainz.de/~frink/nt.html

    This is a similar more advanced version in C++.
    http://www.thecodeproject.com/dialog/keystroke.asp

  8. #8
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218
    Cool!

    hi fordy, i never had any use for spy++, but i checked it out,
    and its such a great shortcut tool.

    but how come it doesnt have ,info for all the programs on my system?

    for desktop, if i want to color the desktop without the use of
    SetSYSColor can i simply subclass the desktop window class proc info in spy++, to do the same? how about rearanging icon or the size of desktop(rect)?

    but for desktop WNDPROC , it doesnt provide any info.

  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    You can use spy to get a handle to the view window that makes up the desktop.....and indeed the systray and the taskbar.....

    But if you want to control the icons your better off using the com interafce - IActiveDesktop as this allows you to control how the desktop is laid out.

    For changing the display size try ChangeDisplaySettings()

    Oh...almost forgot - and to get the WNDPROC of a window - GetWindowLong()

  10. #10
    src
    src is offline
    Registered User
    Join Date
    Feb 2003
    Posts
    7
    Thank You all

  11. #11
    src
    src is offline
    Registered User
    Join Date
    Feb 2003
    Posts
    7
    Fillyourbrain -
    Isn't WM_COPYDATA only from windows CE?

  12. #12
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    nope, it works for all windows that I'm aware of. (at least since 16 bit)
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sending Strings using SendInput
    By TheWeird1 in forum Windows Programming
    Replies: 3
    Last Post: 07-04-2009, 11:35 PM
  2. Replies: 2
    Last Post: 03-23-2006, 07:08 AM
  3. SendInput()
    By borre_mosch in forum Windows Programming
    Replies: 1
    Last Post: 01-13-2004, 11:36 AM
  4. tagINPUT sendINput
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 03-09-2002, 06:14 PM
  5. tagINPUT and SendInput
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 03-08-2002, 03:08 PM

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