Solved

Using Implements for a non blocking CCRP Timer

Posted on 2013-11-11
4
509 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 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