S
Shawn Mehaffie
I am creating a screen saver in VB.Net 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
Thanks,
Any help will be appreciated.
S. Shawn Mehaffie
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
Thanks,
Any help will be appreciated.
S. Shawn Mehaffie