VB.net ScreenSaver, /p parameter - Help Needed

S

Shawn Mehaffie

I am creating a screen saver and am having a problem with showing the
screensaver form in the preview pane. The code works correctly in the the
form does display within the preview window. I created a simple for for
testing called Preview that only had a label on it and the text "This is a
Test" is hardcoded. By doing this I now that it is not other code I have
written that is causing this. The problems I am having are:

1) The Preview form shows up in the preview window, but it goes away after
displaying the form.
2) Although it does show up in the preview window, it does not show any of
the controls on the preview form. A label that says "This is a Test". The
fom shows on the screen, but there is not text on the scree either.

I have the following code for that /p parameter:

Case Is = "/p"

Try
Dim style As Integer
Dim commonVideoSS As New Common
Dim PreviewHandle As Integer = Int32.Parse(CType(args(1), String))
Dim corners As Win32RECT = New Win32RECT

If commonVideoSS.MediaPlayerSetup(frmVideoSS.wmpVideoSS) Then
'Get WindowRec for preview window
corners.GetClientRect(PreviewHandle, corners)

'Reset form to size of preview window
frmPreview.WindowState = FormWindowState.Normal
frmPreview.Width = corners.Width
frmPreview.Height = corners.Height
frmPreview.wmpVideoSS.fullScreen = False
frmPreview.wmpVideoSS.Width = corners.Width
frmPreview.wmpVideoSS.Height = corners.Height

'Set the style
style = GetWindowLong(frmVideoSS.Handle.ToInt32, GWL_STYLE)
style = style Or WS_CHILD

'Set properties so form displays in preview window
SetWindowLong(frmVideoSS.Handle.ToInt32, GWL_STYLE, style)
SetParent(frmVideoSS.Handle.ToInt32, PreviewHandle)
SetWindowLong(frmVideoSS.Handle.ToInt32, GWL_HWNDPARENT,
PreviewHandle)
SetWindowPos(frmVideoSS.Handle.ToInt32, 0, 0, 0, corners.right,
corners.bottom, SWP_NOZORDER Or SWP_NOACTIVATE Or SWP_SHOWWINDOW)
End If
End Catch

There is probably something really simple missing, but I cannot figure out
what it is.

Thanks,

Any help will be appreciated.
S. Shawn Mehaffie
 
H

Herfried K. Wagner [MVP]

* "Shawn Mehaffie said:
I am creating a screen saver and am having a problem with showing the
screensaver form in the preview pane. The code works correctly in the the
form does display within the preview window. I created a simple for for
testing called Preview that only had a label on it and the text "This is a
Test" is hardcoded. By doing this I now that it is not other code I have
written that is causing this. The problems I am having are:

1) The Preview form shows up in the preview window, but it goes away after

How do you display the form? Do you display the same instance? This
may cause re-parenting of the form.
2) Although it does show up in the preview window, it does not show any of
the controls on the preview form. A label that says "This is a Test". The
fom shows on the screen, but there is not text on the scree either.

Does text you draw directly onto the form show up (drawn in the form's
'OnPaint' method)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top