By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

VB.net ScreenSaver, /p parameter - Help Needed

P: n/a
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.wmpVideo SS) 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
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
* "Shawn Mehaffie" <PC************@hotmail.com> scripsit:
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)?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.