VB6 Simple Lock Program - Easily Secure Your Computer with a Password

  • Thread starter Thread starter madmike159
  • Start date Start date
  • Tags Tags
    Lock Program
AI Thread Summary
A user developed a lock program that remains on top of other applications and can only be closed with a password. However, the form can still be resized, which poses a problem. The user attempted to use scalewidth and scaleheight properties to make the form fullscreen but encountered issues with the code. Suggestions from other users included using the vbModal keyword to load the form, setting properties to create a fixed dialog, and disabling the control box and movement. There was a discussion about whether the program could be closed using Task Manager or Alt+F4, with clarifications that the original intention was to restrict actions within the application rather than the entire OS. Additional advice included handling KeyDown/KeyUp events to prevent Alt+F4 and a suggestion to transition from VB6 to VB.NET for improved functionality.
madmike159
Gold Member
Messages
369
Reaction score
0
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.

Code:
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 :biggrin:
 
Technology news on Phys.org
madmike159 said:
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.

Code:
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 :biggrin:

Just load the form with the vbModal keyword:

Code:
form1.Show vbModal

Then change the form properties as follows:

Code:
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
 
so your saying that the program won't even shut down with the task manager or with
alt + f4?
 
cam875 said:
so your saying that the program won't 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
 
ive no idea what he meant now lol, but I guess he'll be the decider when he posts again.
 
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).
 
as edsousa suggests, maybe it's time to move on from VB6. VB.NET is a lot nicer these days.
 
Back
Top