Home All Groups Group Topic Archive Search About
Author
22 Nov 2004 3:01 PM
news.de.bosch.com
Hello,

does anybody know a way to keep a key pressed programmatically?


TIA

Stephan

Author
22 Nov 2004 6:59 PM
Herfried K. Wagner [MVP]
"news.de.bosch.com" <stephan.ma***@de.bosch.com> schrieb:
> does anybody know a way to keep a key pressed programmatically?

How should that work?  Do you have a robot that is able to press keys?

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
22 Nov 2004 8:12 PM
Jeff Gaines
On 22/11/2004 Herfried K. Wagner [MVP] wrote:

> "news.de.bosch.com" <stephan.ma***@de.bosch.com> schrieb:
> > does anybody know a way to keep a key pressed programmatically?
>
> How should that work?  Do you have a robot that is able to press keys?

XP64 beta1 for robots is due next Spring :-)

--
Jeff Gaines Damerham Hampshire UK
Author
23 Nov 2004 7:20 AM
Stephan Mader
hm ok, maybe my question can be misunterstood.

What i want to realize is to _simulate_ a pressed key programatically. For
example to create the possibility to toggle the ALT keystate using a
checkbox...

Show quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb im Newsbeitrag
news:eQTq0VM0EHA.752@TK2MSFTNGP12.phx.gbl...
> "news.de.bosch.com" <stephan.ma***@de.bosch.com> schrieb:
> > does anybody know a way to keep a key pressed programmatically?
>
> How should that work?  Do you have a robot that is able to press keys?
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
23 Nov 2004 11:28 AM
Jeff Gaines
On 23/11/2004 Stephan Mader wrote:

> hm ok, maybe my question can be misunterstood.
>
> What i want to realize is to simulate a pressed key programatically.
> For example to create the possibility to toggle the ALT keystate
> using a checkbox...

Stephan

OK, no robots :-)

Have a look in the help at the 'SendKeys' class - will that do what you
want?

--
Jeff Gaines Damerham Hampshire UK
Author
23 Nov 2004 12:31 PM
Nigel Armstrong
Hi Stephan

What do you want your code to do? Why don't you respond to KeyDown and KeyUp
events to toggle the state of your application, then use a Timer to
repeatedly execute an action while the state shows the key is down. You might
want to use KeyPreview on a form so that you get all the keyboard events
before they are routed to individual controls.

HTH

Nigel Armstrong

Show quote
"Stephan Mader" wrote:

> hm ok, maybe my question can be misunterstood.
>
> What i want to realize is to _simulate_ a pressed key programatically. For
> example to create the possibility to toggle the ALT keystate using a
> checkbox...
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb im Newsbeitrag
> news:eQTq0VM0EHA.752@TK2MSFTNGP12.phx.gbl...
> > "news.de.bosch.com" <stephan.ma***@de.bosch.com> schrieb:
> > > does anybody know a way to keep a key pressed programmatically?
> >
> > How should that work?  Do you have a robot that is able to press keys?
> >
> > --
> >  M S   Herfried K. Wagner
> > M V P  <URL:http://dotnet.mvps.org/>
> >  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
>
>
>
>

AddThis Social Bookmark Button