Solved

Using Implements for a non blocking CCRP Timer

Posted on 2013-11-11
4
498 Views
Last Modified: 2013-11-12
Experts, I am using Implements to use a non blocking ccrp timer. I need to declare the implements twice because i want to use two timers. Below is the code for one timer. But i do not know how to use implements to get two timer events.

Please let me know what i can do to get two timers running.

Implements ICcrpTimerNotify
Private receiveTimer As ccrpTimer

Private Sub Form_Load()

    Set receiveTimer = New ccrpTimer
    Set receiveTimer.Notify = Me
    
    receiveTimer.EventType = TimerPeriodic
    receiveTimer.Interval = 20
    receiveTimer.Stats.Frequency = 10
    
End Sub

Private sub ICcrpTimerNotify_Timer(Milliseconds as Long)

	'Do Timer stuff

End Sub

Open in new window

0
Comment
Question by:Basicfarmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 total points
ID: 39640715
Check out the example on how to use multiple timers:
http://vb.mvps.org/tools/ccrpTmr/docs/ccrpDemoObjArray.htm
0
 
LVL 10

Accepted Solution

by:
joriszwaenepoel earned 250 total points
ID: 39640938
You cannot implement the same interface more than once in a single class.

I do not know these CCRP-interfaces, but if you need 2 timers, maybe you need to create 2 instances of the class? Or you need to implement another interface IccrpTimerNotifyEx for mulitple timers?

See
http://vb.mvps.org/tools/ccrpTmr/docs/ccrpMiscInterfaces.htm
0
 

Author Comment

by:Basicfarmer
ID: 39642292
I have seen those pages and i have the CCRP Timer projects as examples. I can run a single timer. I see how the array example works but it not really multiple independent counters.

I tried to put this in a class and then raise an event thinking that way i could have two independent non blocking timers. But i cannot get it to work. I think it has something to do with Set receiveTmr.Notify = Me because it is in a class. Any ideas?

Implements ICcrpTimerNotify
Private receiveTmr As ccrpTimer

Public Event onTimer(Milliseconds As Long)

Private Sub Class_Initialize()
   
   Set receiveTmr = New ccrpTimer
   Set receiveTmr.Notify = Me
   
   receiveTmr.EventType = TimerPeriodic
   receiveTmr.Interval = 20
   receiveTmr.Stats.Frequency = 10

End Sub

Private Sub ICcrpTimerNotify_Timer(ByVal Milliseconds As Long)

    RaiseEvent onTimer(Milliseconds)

End Sub

Public Sub startTmr()

    receiveTmr.Enabled = True

End Sub

Public Sub stopTmr()

    receiveTmr.Enabled = False

End Sub

Open in new window

0
 

Author Closing Comment

by:Basicfarmer
ID: 39642836
Thanks guys, even though i had seen those examples before i didnt really understand them. The suggestion to create another class got me pointed in the right direction.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question