Results 1 to 9 of 9

Thread: Screensaver Blues

  1. #1

    Thread Starter
    Junior Member Ander123's Avatar
    Join Date
    Mar 2002
    Location
    Canada
    Posts
    22

    Question Screensaver Blues

    (Since this is the Graphics forum, I thought I'd use a color in the subject---woo ha ha.)

    I'm writing a custom screensaver (in VB6) that some of you may find pretty boring---it displays random text and quotes. However, I'd really appreciate your help with a couple of things:

    (1) As usual, I copy the .scr file to Windows/System, then choose it from the Screen Savers list in Display Properties. The screensaver then runs after the designated time.

    However, from that point on, Windows no longer shows the screensaver's title in the Screen Savers box; it's reset to "(None)." And yet Windows keeps running the screensaver normally. How come it can't remember the name? And why does it keep using it when the box says "(None)"?

    (2) I'd like to add the option to smoothly scroll the text across the screen. I've tried Move (with the text in a picture box)---and it's very fast, even with DoEvents in the loop (which you need, right?). However, when I try to control the speed by adding a timer-check loop:

    TimesUp = False
    Do
    DoEvents
    If TimesUp = True then Exit Do
    Loop

    ...everything slows to a crawl---even with the timer set to 1 millisecond.

    Am I doing this all wrong? If I need to use API calls, etc., do you think you could explain it so even a non-genius like I could understand?

    Thanks for your help!

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    Use gettickcount API. Such as:

    VB Code:
    1. TimesUp = Gettickcount + Delay
    2. Do
    3.  DoEvents
    4. Loop until TimesUp <= Gettickcount

    TimesUp needs to be a long (&), and delay should be a positive value (for obvisus reasons), and should also be a long. The Delay value is the number of milliseconds to delay for.
    Involved in: Sentience

  3. #3
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    You would have to use the Api Viewer (or a search of the forums) to find the declation of the api. My school didn't bother to install the api viewer (those cheap asses... ).
    Involved in: Sentience

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Declare Function GetTickCount Library "kernel32" () As Long
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Junior Member Ander123's Avatar
    Join Date
    Mar 2002
    Location
    Canada
    Posts
    22
    Thanks, guys! I'll give it a try ASAP.

    Cheers, Ander

  6. #6

    Thread Starter
    Junior Member Ander123's Avatar
    Join Date
    Mar 2002
    Location
    Canada
    Posts
    22

    Wow!

    Wow---getTickCount is great! I may never use a timer again. :?)

    Thanks, guys. You're geniuses.

    By the way, the actual declaration is:

    Declare Function GetTickCount Lib "kernel32" () As Long

    ("Lib" instead of "Library".)

  7. #7
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    *smile* YES! YES! Timers are evil

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    If you need more precision, you can use the QueryPerformanceCounter/Frequency API calls. They offer (depending on the computer) < 1 ms accuracy.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  9. #9
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You know, that Declare thing is the only thing I've ever used in VB, and that's a while ago.
    Used it to insert my own lib into someone else's app...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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