Display a screen saver

Posted on 1999-07-15
Medium Priority
Last Modified: 2010-04-30
I know how the /s and /c parameters work. Is there a way to display a preview of the screen saver in the preview window using VB 6.
Question by:LSDyeman
  • 3
LVL 13

Accepted Solution

Mirkwood earned 600 total points
ID: 1525115
Use the /p parameter.
The /p parameter is preview

' Check the command line arguments
    ' The command-line argument /p is used to launch the preview box
    If Left(Command$, 2) = "/p" Then
       RunMode = RM_PREVIEW

    ' The command-line argument /c is used to launch the screen saver in setup mode
    ElseIf Left(Command$, 2) = "/c" Then
       RunMode = RM_CONFIGURE

    ' The command-line argument /s is used to launch the screen saver in normal operating mode
    ElseIf Left(Command$, 2) = "/s" Or Command$ = "" And Not App.PrevInstance Then
       RunMode = RM_NORMAL
    ' The command-line argument /a is used to launch the password mode
    ElseIf Left(Command$, 2) = "/a" Then
       RunMode = RM_PASSWORD
LVL 13

Expert Comment

ID: 1525116
Untested code that I have just sitting here waiting for me to have some time to play with it!

Public Sub PreviewDisplay()
  ' this routine displays a form in the little screen saver preview display
  ' note: code based on source by Jeff Hack
  ' the preview window handle will be in the right 3 chars of the calling arguments
  Dim Temp%, PrevHWND As Long
  ' note we don't show the "Main_Form" here as it tries to maximize itself
  ' against the entire screen and besides a mouse move/key press could end the
  ' display instead of clicking on a button.
  PrevHWND = CLng(Right$(Command$, Len(Command$) - 3))
  Temp% = SetParent(PreviewForm.Picture1.hWnd, PrevHWND) 'set active window to the preview window
  ' show the graphic in the window, this is a static display but
  ' a active one could be done here
  PreviewForm.Picture1.Left = 0
  PreviewForm.Picture1.Top = 0
  DoEvents        'allow Windows to check for other events
  Do While IsWindowVisible(PrevHWND) <> 0 ' wait around until the window dissapears (ok or cancel)
    DoEvents  'allow Windows to check for other events
End Sub


Author Comment

ID: 1525117
Sounds good to me. I'll have to try it. If it works, I can send you a copy of my screen saver, if you want.
LVL 13

Expert Comment

ID: 1525118
I'd like that

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

587 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