|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
keep a key pressedHello,
does anybody know a way to keep a key pressed programmatically? TIA Stephan "news.de.bosch.com" <stephan.ma***@de.bosch.com> schrieb: How should that work? Do you have a robot that is able to press keys?> does anybody know a way to keep a key pressed programmatically? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> On 22/11/2004 Herfried K. Wagner [MVP] wrote:
> "news.de.bosch.com" <stephan.ma***@de.bosch.com> schrieb: XP64 beta1 for robots is due next Spring :-)> > 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? -- Jeff Gaines Damerham Hampshire UK 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/> On 23/11/2004 Stephan Mader wrote:
> hm ok, maybe my question can be misunterstood. Stephan> > 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... OK, no robots :-) Have a look in the help at the 'SendKeys' class - will that do what you want? -- Jeff Gaines Damerham Hampshire UK 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/> > > > > |
|||||||||||||||||||||||