Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Screensavers and XP 1

Status
Not open for further replies.

Iago

Technical User
Jun 3, 2002
4
0
0
GB
I have been trawling the net for a solution to the following - I have found several instances of people with the same problem but as yet no solutions - can anyone help?

Problem: A vb screensaver project works perfectly well when run via double-clicking or using the screensaver setting dialog box's "Preview" button. However, when XP launches the screensaver as a screensaver proper it simply produces a blank title bar in the bottom left hand corner of the screen, just above the taskbar. It is almost as if the form is being run minimized, even though it has been set up to be maximized. Double clicking on this title bar will bring the screen saver up but not maximized.

I read somewhere that hiding the taskbar would fix this - it doesn't. It's driving me mad!
 
Incredibly I have just discovered the solution is to include the following line in the Form_Load() subroutine

<NameOfForm>.WindowSate=vbMaximized

It's obvious how this works, but not obvious why simply setting this parameter for the form at the design stage doesn't! Any comments gratefully received.

 
I had the same problem with Win2000 and found this code on VBWorld.com that fixed it. Put the following code in a module of your project.

**************************************

Global Const HWND_TOP = 0&
Global Const SWP_NOZORDER = &H4
Global Const SWP_SHOWWINDOW = &H40
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2

Declare Sub SetWindowPos Lib &quot;user32&quot; (ByVal _
hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal _
cx As Long, ByVal cy As Long, ByVal wFlags As Long)

************************************
Then add the following at the top of you Form_Load()
**************************************
sw = Screen.Width
sh = Screen.Height
' Tell windows to make form top most window, form.left,form.top,width, height, Flags
' the value 68 represenses the CONST's &quot;SWP_NOZORDER&quot; and &quot;SWP_SHOWWINDOW.&quot;
' &quot;SWP_SHOWWINDOW&quot; must be included in the flag for saver to work with Win2k.
SetWindowPos ourformname.hwnd, HWND_TOPMOST, 0, 0, sw, sh, 68
*************************************
I haven't tested in XP yet, but it's worth a shot.

My problem now is verifing the password in Win2000, any thoughts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top