|
-
May 18th, 2001, 07:23 AM
#1
Screensaver + Preview Window
Code:
GetClientRect GetHwndFromCmd(cmd), SDim
Style = GetWindowLong(Form2.hwnd, GWL_STYLE) ' ** Get current window style
Style = Style Or WS_CHILD ' ** Append "WS_CHILD" style To the hWnd window style
SetWindowLong Form2.hwnd, GWL_STYLE, Style ' ** Add New style To window
SetParent Form2.hwnd, GetHwndFromCmd(cmd) ' ** Set preview window As parent window
SetWindowLong Form2.hwnd, GWL_HWNDPARENT, GetHwndFromCmd(cmd) ' ** Save the hWnd Parent In hWnd's window struct.
SetWindowPos Form2.hwnd, HWND_TOP, 0&, 0&, SDim.Right, SDim.Bottom, SWP_SHOWWINDOW
This code does show the screensaver in the small preview box in display properties.. but it does not scale the form.. How can I achieve this?
Also can i draw directly into the preview box..?
GetDC(GetHwndFromCmd) doesn't seem to be working!
-
May 18th, 2001, 10:36 AM
#2
Hyperactive Member
Hello there,
For zooming, you might want to try multiplying all your numbers by the ratio ScreenWidth/PreviewScreenWidth when displaying in the preview window (/c), and by 1 when displaying on the screen (/s).
-
May 18th, 2001, 01:55 PM
#3
PowerPoster
This is a slightly modified version of the code found on vbworld
Code:
Public Sub DoPreviewMode()
'get the handle for the preview area
dispHWND = CLng(Right$(Command$, Len(Command$) - 3))
'load the preview window independently, but do not show it
Load frmPreview
'get the size of the preview area
GetClientRect dispHWND, DispRec
'set the preview window according to the size of the preview area
SetWindowPos frmPreview.hwnd, HWND_TOP, 0&, 0&, _
DispRec.Right, DispRec.Bottom, _
SWP_NOZORDER Or SWP_NOACTIVATE Or SWP_HIDEWINDOW
'set the preview window as child window
style = GetWindowLong(frmPreview.hwnd, GWL_STYLE)
style = style Or WS_CHILD ' Append "WS_CHILD"
SetWindowLong frmPreview.hwnd, GWL_STYLE, style
SetParent frmPreview.hwnd, dispHWND
SetWindowLong frmPreview.hwnd, GWL_HWNDPARENT, dispHWND
'show the form
frmPreview.Show
End Sub
This code is working fine for me. It sizes the form according
to the preview area. I don't think you can draw directly into
the preview area as its most probably a mdi window.
Gush, Preview window command line switch is "/p". "/c" is for
configuration settings.
-
May 18th, 2001, 08:35 PM
#4
-
May 18th, 2001, 09:45 PM
#5
No.. but form is still not scaled!!
-
May 19th, 2001, 02:56 AM
#6
PowerPoster
The form does not gets scaled. A portion of the form equal to
the size of the preview window is taken starting from the top left
of your form. There is no automatic scaling of the form. If you are
drawing onto the form, draw on the form after you have sized
according to the preview area.
-
May 19th, 2001, 05:06 AM
#7
ok.. thanks for the idea.. didn't think about it b4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|