CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005
    Posts
    26

    Question Global Timer Class with Events?

    I am new to COM programming. Is it possible to construct a timer that can used globally, instead of just one form?

    I have an app at factory which is reading in temperatures, tach rates, etc.

    I would like to get timer that works on all forms.

    Using label change events, I would like to alert the Global timer that a certain threshold has been surpassed by examining the value of the label.caption. I would then like to pass the control name as an argument to the Global timer. The timer will then turn the control's visible property on/off at 1-sec intervals to better alert the operator.

    Is there a way upgrade the existing timer control to do this? I'd appreciate any general ideas about this, or let me know if it's a bad way to do this.

    Thanks for any input,
    Dave
    'Hello World'

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Global Timer Class with Events?

    You could have a form that's open all the time, yet minimized that has the timer in it. Or else, use some API's to mimic one yourself.

    Code:
    Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long
    Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Featured