Link to home
Start Free TrialLog in
Avatar of LSDyeman
LSDyeman

asked on

Display a screen saver

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.
ASKER CERTIFIED SOLUTION
Avatar of Mirkwood
Mirkwood

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mirkwood
Mirkwood

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
   
  Loop
     
  End
     
End Sub

Avatar of LSDyeman

ASKER

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.
I'd like that