VB6 Help


by madmike159
Tags: None
madmike159
madmike159 is offline
#1
Dec18-08, 02:16 PM
PF Gold
madmike159's Avatar
P: 370
I made a simple lock program which is always ontop of other programs, I've removed all the controls from the form such as the cross button, it can only be closed by entering a password. The form can still be resized though so people can still use the computer. To get around this I tryed using the scalewidth and scalehigh options to resize it to full screen.

form1.scalewith = 11400
form1.scalehight = 15000
This is in a timer as a simple way rather than check it has been resized by the user. I can't get thecode to work though, even in something like a command button.

Can anyone work out where I'm going wrong?

thanks
Phys.Org News Partner Science news on Phys.org
NASA's space station Robonaut finally getting legs
Free the seed: OSSI nurtures growing plants without patent barriers
Going nuts? Turkey looks to pistachios to heat new eco-city
stewartcs
stewartcs is offline
#2
Dec26-08, 09:00 PM
Sci Advisor
stewartcs's Avatar
P: 2,283
Quote Quote by madmike159 View Post
I made a simple lock program which is always ontop of other programs, I've removed all the controls from the form such as the cross button, it can only be closed by entering a password. The form can still be resized though so people can still use the computer. To get around this I tryed using the scalewidth and scalehigh options to resize it to full screen.

form1.scalewith = 11400
form1.scalehight = 15000
This is in a timer as a simple way rather than check it has been resized by the user. I can't get thecode to work though, even in something like a command button.

Can anyone work out where I'm going wrong?

thanks
Just load the form with the vbModal keyword:

form1.Show vbModal
Then change the form properties as follows:

BorderSytle = Fixed Dialog
ControlBox = False
Moveable = False
This will create a pop-up form that will prevent them from doing anything until they enter the correct password. Of course the code for the correct password should unload the form as well as do whatever else you want it to.

Hope this helps.

CS
cam875
cam875 is offline
#3
Dec30-08, 11:06 AM
P: 230
so your saying that the program wont even shut down with the task manager or with
alt + f4?

stewartcs
stewartcs is offline
#4
Dec30-08, 12:28 PM
Sci Advisor
stewartcs's Avatar
P: 2,283

VB6 Help


Quote Quote by cam875 View Post
so your saying that the program wont even shut down with the task manager or with
alt + f4?
No, I'm not. Perhaps I misread the OP's question. I assumed he meant all windows inside the VB application and not all windows (or applications) in the OS.

CS
cam875
cam875 is offline
#5
Dec30-08, 02:48 PM
P: 230
ive no idea what he meant now lol, but I guess he'll be the decider when he posts again.
edsousa
edsousa is offline
#6
Dec31-08, 11:36 AM
P: 3
1st: madmike, why are you still using VB6?

2nd: stewartcs showed the solution. btw, to prevent Alt+F4 the KeyDown/KeyUp events should have an handler that cancels it. For the Ctrl+Alt+Del there's nothing you can do, unless you make your program a system service (Win 2k and above).
harborsparrow
harborsparrow is offline
#7
Jan6-09, 09:18 AM
harborsparrow's Avatar
P: 322
as edsousa suggests, maybe it's time to move on from VB6. VB.NET is a lot nicer these days.


Register to reply