PDA

Click to See Complete Forum and Search --> : Always on top of an always on top form!


Aug 30th, 2000, 07:49 AM
I'm trying to emualte the Workstation Lockout thingy that WinNT does.

I've got 2 forms:

The first one has no border and is the same colour as the desktop. It's been sized to fill the entire screen (masking off the crap behind it) and I've used "SetWindowPos" to make it stay on top of the taskbar etc.

Now I have another form where someone enters a username and password in order to unlock the computer.

My problem is that I need to make this second form stay on top of the first one (which is already always on top).

I can't manage to do this reliably. Sometimes it works...others it doesn't work and cos I've also disabled ctrl+alt+del etc I have to reboot.

I've tried just using SetWindowPos on the second form, I've tried messing with the OwnerForm argument when I show the second form modally...I've even tried using an MDI form for the background one but I can't get rid of its title bar.

Any ideas how I can achieve this?

Aug 30th, 2000, 08:23 AM
Show it as a modal form.

MyForm.Show vbModal

Glacius Cool
Aug 30th, 2000, 09:14 PM
You need to call the Password input form from the Always On Top form then set the Password form as Always On Top then (here's the key), set the Pasword form's ZOrder to 0(zero)

Private Sub ShutoutForm_Click()
PaswordForm.Show
OnTop PasswordForm.hWnd, True 'OnTop is the sub to make the form stay on top
PasswordForm.ZOrder 0 'This will put the form on top of all others that are OnTop
End Sub

One more note: During development, always leave yourself an exit, whether it be a key press or a specific location on your form that you can click to exit.

[Edited by Glacius Cool on 08-30-2000 at 10:18 PM]