Results 1 to 5 of 5

Thread: VB6 Timer

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    2

    VB6 Timer

    Hi, I'm currently using a timer to record user scroll and click events with interval being 1 millisecond. It turns out that vb6 timer is not accurate at all. In fact, one second in real life is about 62 units produced by the program. Is there a more accurate way to keep track of time?

    Thanks!

  2. #2
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: VB6 Timer

    Quote Originally Posted by rqian
    Hi, I'm currently using a timer to record user scroll and click events with interval being 1 millisecond. It turns out that vb6 timer is not accurate at all. In fact, one second in real life is about 62 units produced by the program. Is there a more accurate way to keep track of time?

    Thanks!
    1 milisecond can put you pc very slow.... and don't forget 1000 miliseconds=1second
    i hope these information help
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    2

    Re: VB6 Timer

    I understand, but I hope to capture mouse scroll and click events in regards to my program.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: VB6 Timer

    A typical timer (like VB's timer) is about the lowest priority message your app will receive. Mouse events are much higher priority. Timer messages are processed when all other priority messages have been processed. This means when your timer event fires, you may have already missed dozens upon dozens of mouse events. I cannot see anyway you can reliably trap mouse movement events with a timer.

    Either use the mouse events in your controls (i.e., MouseMove, MouseDown, MouseUp, etc) or subclass/hook your project and trap the mouse events. Subclassing and hooking are very advanced techniques. Unless someone else provides a suitable alternative, and you decide you want to investigate hooking and are not familiar with it, do some searching on this forum -- you probably will need days, if not weeks, to fully understand it and be able to use without crashing your application.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width