Timers in PB/DLL 
Author Message
 Timers in PB/DLL

Not that I really need them for now, but during my study time in the help
file it hit's me that I don't have a clue on how to produce a timer in PB.
I'm used to the VB timer object so as PB isn't object related in that way..


Tue, 23 Apr 2002 03:00:00 GMT  
 Timers in PB/DLL

Quote:

> Not that I really need them for now, but during my study time in the help
> file it hit's me that I don't have a clue on how to produce a timer in PB.
> I'm used to the VB timer object so as PB isn't object related in that way..

You could program it the WM_TIMER message way (others will probably
explain that here) but this is a more familiar approach, write your main
message loop something like this. You should be able to figure out the
rest, like variable types etc.

  Timeout = 0.1 ' in seconds
  Delay = 50    ' in milliseconds
  ExitState = %FALSE
  DO
    WHILE PeekMessage(Msg, %NULL, 0, 0, %PM_NOREMOVE)
      IF GetMessage(Msg, %NULL, 0, 0) = 0 THEN
        ExitState = %TRUE
      END IF
      TranslateMessage Msg
      DispatchMessage Msg
    WEND
    ApiSleep Delay 'don't make the loop too tight
    IF ABS(TIMER - LastTime) > Timeout THEN
      'do whatever timer functions here:

      LastTime = TIMER
    END IF
  LOOP UNTIL ExitState
  'cleanup code here

--
Peter Manders.
Please remove the 'u' to reply.



Tue, 23 Apr 2002 03:00:00 GMT  
 Timers in PB/DLL

Quote:
> Not that I really need them for now, but during my study time in the help
> file it hit's me that I don't have a clue on how to produce a timer in PB.
> I'm used to the VB timer object so as PB isn't object related in that
> way..

There are various ways and means, depending on what you might want
to accomplish. The most flexible involves a Windows timer object, which
is what the VB timer is based on. Unfortunately, Microsoft's MSDN
library grows ever more impenetrable as they lump every possible topic
and compiler under one sloppy index... let's see... ok.

Check out the SetTimer API call. The most important setting is the
number of milliseconds until the timer goes off. You can choose to
have the "now!" message sent to a callback function, or intercept the
timer message in your message-processing loop, depending.

Timer messages run at a low priority, and can best be thought of as
providing a service where you describe the minimum amount of time
before a timer goes off. Depending on other system tasks and so
forth, you may get the message "fashionably late". This is a Windows
"feature", and applies to services such as the VB timer object as well.



Wed, 24 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. MX Lookup with PB/CC or PB/DLL

2. TCPADDR for PB/DLL & PB/CC

3. Info on new PB/CC and PB/DLL

4. Announcing the JazzAge COM Wizard for PB/DLL and PB/CC

5. animated characters, speech input/output in PB/DLL and PB/CC

6. email enable PB/DLL-PB/CC using Outlook

7. SQL, ADO/OLE-DB programming in PB/DLL and PB/CC

8. PB DLL's for Visual Basic

9. PB DLL Disk Info

10. PB/DLL and PCMCIA

11. PB/DLL

12. Fonts in dialog boxes (PB/DLL 1.5)

 

 
Powered by phpBB® Forum Software