Results 1 to 3 of 3

Thread: Timer or not??

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298
    I have written a program that checks the resolution every 1 sec for a resoltion change so that the program can alter the desktop picture.

    1) I know there is a better way than using a timer to check but I am not sure how to do it.

    2) Does anyone know how to activate the Active Desktop and add a htm file as the backgroud via VB.

    The reason I would like to change it is that when you alter the Resolution and don't immediatley click to maintain the settings it causes a fatal exception.

    Any help would be greatly apprectated.


    Regards Matt

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    You can use GetTickCount() :

    Code:
    Dim LastTick As Long
    Dim CurrentTick As Long
    Private Const UpdateSpeed As Long = 60
    'Change the UpdateSpeed as required
    
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    
    Private Sub RunGameLoop()
        'Rename the loop if applicable ...
        Do
            CurrentTick = GetTickCount()
            DoEvents
            If ((CurrentTick - LastTick) >= UpdateSpeed) Then
                LastTick = GetTickCount()
                'Do the res checking
            End If
        Loop
    End Sub
    That should do it.

    - Jamie
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Thanks

    Thanks a lot at the rate you are going you'll be writing all my prgram.

    Thanks again

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