CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007
    Posts
    28

    playing your own custom screen saver

    Is there an api or class for screen savers. I want to add a screen saver to my program and be able to set how long it takes to kick in and be able to play videos/slideshows randomly as screensavers. Alternatively if someone knows how to do it with xp how can i add a list of videos to be played randomly. I know xp can play slides of your pictures but can you do this with videos.
    Thank you

  2. #2
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: playing your own custom screen saver

    I don't know of a class for it yet, but you can use the following API, and function to obtain, the number of milliseconds since the last input(key/mouse).

    Code:
        Private Structure PLASTINPUTINFO
            Public cbSize, dwTime As Int32
        End Structure
    
        Private Declare Function apiGetLastInputInfo Lib "user32" Alias "GetLastInputInfo" (ByRef plii As PLASTINPUTINFO) As Int32
        Private Declare Function apiGetTickCount Lib "kernel32" Alias "GetTickCount" () As Int32
    
        Private Function GetLastInput() As Int32
            Dim li As New PLASTINPUTINFO
            li.cbSize = Runtime.InteropServices.Marshal.SizeOf(li)
            apiGetLastInputInfo(li)
            GetLastInput = (apiGetTickCount - li.dwTime)
        End Function
    
        Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
            Me.Text = GetLastInput()
        End Sub

  3. #3
    Join Date
    Aug 2005
    Location
    Imperial College London, England
    Posts
    490

    Re: playing your own custom screen saver

    Are you talking about making your own screen saver? There are actually just normal programs which have been renamed as .scr, and they have a few standard control inputs.
    A quick search on google should should turn up the skeleton code to desgin your own screensaver.
    Help from me is always guaranteed!*
    VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
    Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.

    *Guarantee may not be honoured.

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: playing your own custom screen saver

    How about a different image on dual-monitors for the screen saver?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Featured