[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
Go Back  Xtreme Visual Basic Talk > > > [VB 2008 EXP]Globally press keys down


Reply
 
Thread Tools Display Modes
  #1  
Old 04-05-2009, 12:29 PM
-Cluster- -Cluster- is offline
Newcomer
 
Join Date: Feb 2009
Posts: 7
Lightbulb [VB 2008 EXP]Globally press keys down


Hi,
I am trying to make a program that outputs a series of key presses into another window. I have been trying to do this with the SendKeys but have found that it it presses the key too quickly for the other application to be affected enough to cause much output. I need a way to globally press the key down and key it up over a period of time. If I know the code for pressing a key down and up globally I'll be able to link it up with a timer and work from there assuming the key codes are the same as SendKeys.

Thanks in advance.

PS I didn't know where to put this that's why its in general sorry if I got it wrong
Reply With Quote
  #2  
Old 04-05-2009, 12:37 PM
Qua's Avatar
Qua[VB 2008 EXP]Globally press keys down Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Take a look at this class. It should be easily understandable. It provides support for setting/getting the location of the mouse pointer, pressing left/right/middle-button down, releasing those buttons and scrolling the mouse wheel.

In your example you would press the left mouse button, then wait a specific time interval, and then release the left mouse button.
Attached Files
File Type: vb MouseEvents.vb (1.6 KB, 3 views)
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #3  
Old 04-05-2009, 12:40 PM
Qua's Avatar
Qua[VB 2008 EXP]Globally press keys down Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Just noticed that you were looking for executing keyboards presses and not mouse ones

Take a look at this class instead. It is a bit messy since I never got around to clean it up. Should still be quite understandable what the code does though. The class is very much alike its mouse-counterpart.
Attached Files
File Type: vb KeyboardEvents.vb (1.5 KB, 3 views)
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #4  
Old 04-05-2009, 01:05 PM
-Cluster- -Cluster- is offline
Newcomer
 
Join Date: Feb 2009
Posts: 7
Default

Thanks a lot mate I will look over it;

Hey just wanted to know the code for the down, up, left and right arrow keys.

One more thing is there a easier way to do certain action on a particular tick I was thinking along the lines of

if timer2.tick = 10 Then...

but tick doesn't seem top be a valid property

Last edited by -Cluster-; 04-05-2009 at 01:40 PM. Reason: New question
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down [VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
 
[VB 2008 EXP]Globally press keys down
[VB 2008 EXP]Globally press keys down
 
-->