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

  • Thread starter Thread starter madmike159
  • Start date Start date
  • Tags Tags
    Lock Program
Click For Summary

Discussion Overview

The discussion revolves around creating a simple lock program in Visual Basic 6 (VB6) that secures a computer with a password. Participants explore methods to prevent users from closing the program and discuss various properties and methods to achieve a full-screen lock effect.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • The original poster (OP) describes a lock program that remains on top of other applications and can only be closed by entering a password, but it can still be resized.
  • The OP attempts to use the scalewidth and scaleheight properties to resize the form to full screen but encounters issues with the code not functioning as intended.
  • Another participant suggests using the vbModal keyword when showing the form to prevent interaction with other windows until the password is entered.
  • There is a discussion about whether the program can be closed using Task Manager or Alt + F4, with some confusion about the OP's original intent.
  • One participant mentions that to prevent Alt + F4 from closing the program, event handlers for KeyDown/KeyUp should be implemented, while noting that Ctrl + Alt + Del cannot be prevented without making the program a system service.
  • Several participants express skepticism about continuing to use VB6, suggesting that VB.NET may be a better option for modern development.

Areas of Agreement / Disagreement

Participants generally agree on the need for a modal form to restrict access until the password is entered, but there is disagreement and confusion regarding the program's ability to be closed through system commands like Task Manager or Alt + F4. The discussion about the use of VB6 versus VB.NET also indicates differing opinions on the relevance of VB6 in current programming practices.

Contextual Notes

There are unresolved technical details regarding the implementation of the resizing code and the effectiveness of the proposed solutions to prevent closing the program. Additionally, the discussion reflects varying levels of understanding about the capabilities and limitations of VB6.

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.
 

Similar threads

Replies
2
Views
3K
  • Sticky
  • · Replies 48 ·
2
Replies
48
Views
69K
  • · Replies 1 ·
Replies
1
Views
10K
  • · Replies 8 ·
Replies
8
Views
5K