Help - Search - Members - Calendar
Full Version: Working With Windows In Vb.net
Sal's RuneScape Forum > Everything... Not RuneScape > Tech Talk > Programming & Web Development
Kaibamanjrs
Alright, this is the first time I have tried doing this.

I want to select a window(or process I have open), give it focus, and send it some keys as if I was typing something. I am a little stumped though. How would I access these windows?
Roy
QUOTE (Kaibamanjrs @ Aug 4 2009, 07:28 PM) *
Alright, this is the first time I have tried doing this.

I want to select a window(or process I have open), give it focus, and send it some keys as if I was typing something. I am a little stumped though. How would I access these windows?

I'm not sure hat you mean with 'to select a window' but to make your keyboard type something use this:
CODE
My.Computer.Keyboard.SendKeys( something here )

That 'something here' could be a string to type ("hello" would let your keyboard type hello) or a key (chr(Keys.Enter) would make it seem like you pressed enter).
Kaibamanjrs
QUOTE (Roy @ Aug 4 2009, 12:47 PM) *
QUOTE (Kaibamanjrs @ Aug 4 2009, 07:28 PM) *
Alright, this is the first time I have tried doing this.

I want to select a window(or process I have open), give it focus, and send it some keys as if I was typing something. I am a little stumped though. How would I access these windows?

I'm not sure hat you mean with 'to select a window' but to make your keyboard type something use this:
CODE
My.Computer.Keyboard.SendKeys( something here )

That 'something here' could be a string to type ("hello" would let your keyboard type hello) or a key (chr(Keys.Enter) would make it seem like you pressed enter).

Sendkeys only sends to the active window, which is why I need to somehow select a window.

Like if I have notepad running, I want to send sendkeys to that.
Roy
QUOTE (Kaibamanjrs @ Aug 5 2009, 03:55 PM) *
QUOTE (Roy @ Aug 4 2009, 12:47 PM) *
QUOTE (Kaibamanjrs @ Aug 4 2009, 07:28 PM) *
Alright, this is the first time I have tried doing this.

I want to select a window(or process I have open), give it focus, and send it some keys as if I was typing something. I am a little stumped though. How would I access these windows?

I'm not sure hat you mean with 'to select a window' but to make your keyboard type something use this:
CODE
My.Computer.Keyboard.SendKeys( something here )

That 'something here' could be a string to type ("hello" would let your keyboard type hello) or a key (chr(Keys.Enter) would make it seem like you pressed enter).

Sendkeys only sends to the active window, which is why I need to somehow select a window.

Like if I have notepad running, I want to send sendkeys to that.

Put a small delay on it? That you have a second time to get to notepad (easily done with a timer).

EDIT: Or use the leave event in focus?
Kaibamanjrs
QUOTE (Roy @ Aug 5 2009, 03:54 PM) *
QUOTE (Kaibamanjrs @ Aug 5 2009, 03:55 PM) *
QUOTE (Roy @ Aug 4 2009, 12:47 PM) *
QUOTE (Kaibamanjrs @ Aug 4 2009, 07:28 PM) *
Alright, this is the first time I have tried doing this.

I want to select a window(or process I have open), give it focus, and send it some keys as if I was typing something. I am a little stumped though. How would I access these windows?

I'm not sure hat you mean with 'to select a window' but to make your keyboard type something use this:
CODE
My.Computer.Keyboard.SendKeys( something here )

That 'something here' could be a string to type ("hello" would let your keyboard type hello) or a key (chr(Keys.Enter) would make it seem like you pressed enter).

Sendkeys only sends to the active window, which is why I need to somehow select a window.

Like if I have notepad running, I want to send sendkeys to that.

Put a small delay on it? That you have a second time to get to notepad (easily done with a timer).

EDIT: Or use the leave event in focus?

I want it to auto select the window
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.