Thread: Type with code

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    49

    Type with code

    All I seem to be getting via Google is the keypress event. Anyone know of a way to type something into the active control (say a textbox) using code?

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    In general you can just set a control's .Text property, so long as the control belongs to your own program that is.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    49
    That's the thing... it doesn't. I want to be able to type something into the next window to have focus when the program is minimized. Ever use KeePass Auto-Type feature? Thats similar to what I'm looking to achieve.

  4. #4
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    If you want to type into a textbox of an external application, I think you need to wrap FindWindow, FindWindowEx, and SendMessageA APIs as I don't believe there is a way to do it in native .net.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    49
    I think KeePass is opensource. 2.x is built using .net so I'll see how its done hopefully. I've got about a year of programming experience in .net but I'm still not very comfortable with external libraries (and I defintely know next to nothing about the Windows APIs). Where to find a good site to learn about it? I know MSDN but their documenation is more reference for someone whos done it before and needs a refresher.

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    49
    Bingo! :lol:

    I found a .net way of doing this thanks to KeePass most recent release notes

    Its SendKeys.Send("Whatever here"), part of System.Windows.Forms

    See the MSDN article if you're interested.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  4. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM
  5. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM