473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Timed Recurring Key Press

I am looking at writing a program that presses a key ('A') every minute in whatever the focused window is. I am having trouble working out what command to use in the timer1_timer sub so that it presses A and then restarts the timer, what I have at the moment dosn't work. I am using Visual Basic 2005 Express

Here is the code

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     'Disables Timer1 at startup
  4.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  5.  
  6.         Timer1.Enabled = False
  7.  
  8.     End Sub
  9.     'timer stopped on click of end button
  10.     Private Sub cmdEnd_Click()
  11.  
  12.         Timer1.Enabled = False
  13.  
  14.     End Sub
  15.  
  16.     'send keys is activated every time the timer event occurs
  17.     'Restarts the timer
  18.     Private Sub Timer1_Timer()
  19.  
  20.         SendKeys.Send("A")
  21.         Timer1.Enabled = True
  22.  
  23.     End Sub
  24.     'timer enabled on click of start button
  25.     Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
  26.  
  27.         Timer1.Enabled = True
  28.  
  29.     End Sub
  30.     'Creates buble tooltip on mouse hover
  31.     Private Sub cmdStart_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdStart.MouseHover
  32.  
  33.         toolTip.SetToolTip(cmdStart, "Click here to start the timer")
  34.  
  35.     End Sub
  36.     'Creates bubble tooltip on mouse hover
  37.     Private Sub cmdEnd_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdEnd.MouseHover
  38.  
  39.         toolTip.SetToolTip(cmdEnd, "Click here to stop the timer")
  40.  
  41.     End Sub
  42. End Class
  43.  
Dec 29 '06 #1
3 1269
Tried searchig for tutorials and the net and have found zip.
Dec 29 '06 #2
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     'Disables Timer1 at startup
  4.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  5.         Timer1.Enabled = False
  6.     End Sub
  7.     'timer enabled on click of start button
  8.     Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
  9.         Timer1.Enabled = True
  10.     End Sub
  11.     'Creates buble tooltip on mouse hover
  12.     Private Sub btnStart_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnStart.MouseHover
  13.         toolTip.SetToolTip(btnStart, "Click here to start the timer")
  14.     End Sub
  15.     'send keys is activated every time the timer event occurs
  16.     'Restarts the timer
  17.     Private Sub Timer1_Timer()
  18.         SendKeys.Send("{TAB}")
  19.         Timer1.Enabled = True
  20.     End Sub
  21.     'timer stopped on click of end button
  22.     Private Sub btnEnd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEnd.Click
  23.         Timer1.Enabled = False
  24.     End Sub
  25.     'Creates bubble tooltip on mouse hover
  26.     Private Sub btnEnd_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEnd.MouseHover
  27.         toolTip.SetToolTip(btnEnd, "Click here to stop the timer")
  28.     End Sub
  29. End Class
  30.  
What am I doing wrong I can't see any problem in my code :S
Dec 29 '06 #3
Guys found the problem, I was still using VB6 script for the timer. Explains everything :P

The timer should be Timer1_Tick
Dec 30 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Shabam | last post by:
I'm having a calendar feature developed whereby users can add recurring events. These recurring events can have start and end dates, meaning they will recur only within a date range. For...
5
by: gil | last post by:
I initially tried building a coded system where numbers 1 through 10 referenced a certain type of recurring appointment, and would then call a specific function for each, but as more appointments...
2
by: Javaman59 | last post by:
I have a GUI which is monitoring a real-time device. I have several timed actions, such as periodic polling of the device, and indicators which flash for a fixed period. My first implementation...
5
by: Sachin Surana | last post by:
We use HttpWebRequest to send the request at a URL. But some times the method GetResponse throws a time out exception. But when we check the IIS logs, there is no such entry. So the request never...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
1
by: steve | last post by:
Hi All I am writing a program for a gymnasium for membership control It is the first time I have had to deal with appointment diaries and I want to know the best way to store recurring...
2
by: nepdae | last post by:
Please forgive me, this is a long one. My 11-user Access 2000 database is having recurring corruption problems. The symptoms include the following: 1) corrupted fields in recently created or...
12
by: owestcot | last post by:
I'm working on a simple video game program that will require timed responses. The easiest example I can think of would be something like: char ans; // answer to question (can't remember the...
1
by: TC | last post by:
Hi, I have an app that is going to require recurring diary entries, it's a relatively simple app but I have no idea how to go about the recurring entry side of things. The functionality needs to...
0
by: =?Utf-8?B?TWVlbWEgSnVkeQ==?= | last post by:
I have a Verizon Palm Treo 755p and use Outlook 2002 on my new HP Pavilion (Vista 64-bit). When I was syncing on my old XP PC, everything worked fine. On the Vista PC, when I finally got it to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.