|
-
Jan 29th, 2006, 04:55 PM
#1
Thread Starter
Lively Member
Timer Speed Up
I'm current using a timer with an interval of 1000ms.
This timer is created and disposed many times throughout the life of the program via the capture of Alt and C buttons respectively. I dont know if this has any relevance but im using global hooks to start/stop the timer when the form isnt in focus to capture those key down events (for some reason Alt doesnt raise a key press, only a key down.)
After a few creations/disposes it seems the timer interval drastically reduces and approaches 1ms.
i've tried resetting the interval time everytime i create the instance of the timer but that doesnt seem to work.
the timer tick is firing a mouse_event of left button down then after another tick, mouse_vent of left button up.
I've also setup a way to check the interval value and the object always reports it to be 1000ms..which is impossible as i can see the mouse selecting and double clicking anything it comes into contact with. (which should be impossible since i've used the SetDoubleClickTime(1))
any help would be greatly appreciated
-
Jan 29th, 2006, 06:42 PM
#2
Sleep mode
Re: Timer Speed Up
How about this :
http://www.vbforums.com/showthread.p...ighlight=timer
I know it's API function but it'd be more faster and has lower system overhead than using the timer component .
-
Jan 30th, 2006, 06:02 AM
#3
Fanatic Member
Re: Timer Speed Up
It would be helpfull if you could post some of your code.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jan 30th, 2006, 06:10 AM
#4
Re: Timer Speed Up
Why should your Timer be created and destroyed repeatedly? All you need to do is use a single Timer object and call its Start and Stop methods I would have thought. Also, I'd avoid using Alt+<anything> as a keyboard hook because that could have specific meaning in other apps if it is a mnemonic. Ctrl+Alt+<something> is less likely to be meaningful to other apps.
-
Jan 30th, 2006, 10:57 AM
#5
Thread Starter
Lively Member
Re: Timer Speed Up
i originally had the timer being stopped and started using the myTimer.Start() and myTimer.Stop() methods. I thought that the object was getting its properties corrupted somehow so i decided to create/destroy on each use, to no avail.
I have since switched back to the Stop and Start.
The code regarding the high accuracy time span is interesting and i will try it out when i get home.
Since posting i've added a logger to see if there was any logic to the interval decreasing..and it seems that the interval was decreasing by exactly 50% eachtime the timer was disposed/created. I think a possibility is that i have multiple timers firing off tick events and only one method firing on those different timers ( i dont know if thats even possible..but im ready to consider anything right now ).
I'm at work and can't access my code but ill rewrite what i have from scratch for the guy requesting the code.
-
Jan 30th, 2006, 11:50 AM
#6
Fanatic Member
Re: Timer Speed Up
Looks like you just answered your own question, you haven't disposed the timer properly.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|