在用户输入密码之前,如何锁定所有控件? [英] how do you lock all control until user inputs password?

查看:66
本文介绍了在用户输入密码之前,如何锁定所有控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在输入自己的自定义用户密码.当我启动Windows时,我的程序会提示用户输入密码.如果经过几次尝试后仍无法正确操作,则计算机将关闭.我有问题,我想让程序锁定屏幕,直到代码正确为止.

例如,当计算机启动时,会出现一个窗口,提示用户输入代码.除非用户输入正确的代码,否则他将无法访问计算机中的任何内容,就像您在Windows中遇到错误时一样,并且无论您在何处单击背景或单击多少次,它都不允许您执行其他任何操作.

我会感谢您的帮助,该项目仅用于教育目的,所以请不要说它是已经发明的,或者为什么我不只是使用常规登录名.

谢谢,

操作系统Windows 7

visual C#

Hi, I am making my own custom user password. When I start up windows my program prompts the user for the password. If the person does not get it correct after a few tries then the computer shuts down. I have a problem, I want to make the program lock the screen until the code is correct.

Fore example, when the computer starts up a window appears prompting the user to put in the code. Until the user puts in the correct code he is unable to access anything form the computer like whenever you get an error in windows and it wont allow you to do anything else no matter where or how many times you click on the background.

I will appreciate the help, this project is for educational purposes so please don''t say it is invented already or why I don''t just use the regular login.

Thanks,

operating system windows 7

visual C#

推荐答案

在我脑海中,我可以想到几种方法来实现此目的,但是您将遇到一个问题用户可能可以使用任务管理器终止您的应用程序.大多数人(在代码项目中)都有一项政策,就是不提供有关如何防止任务管理器显示的答案,因为虽然您的目的可能不错,但您并不是唯一阅读此书的人,而我们不这样做不想帮助人们编写恶意软件.

这样说,这两种方法是什么?好吧,第一个方法是编写一个始终设置为最高的应用程序,并且该应用程序填充全屏(如果您有多台显示器,则为全屏显示)-您可以使背景为半透明,以显示下方的某些屏幕.

第二种方法利用了Windows确实具有多个桌面的事实.基本上,您将为当前桌面拍摄快照,创建新桌面,将图像粘贴到该桌面上,然后在顶部显示您的应用程序.尝试将其与上述技术结合.

为了创建一个新的桌面,您可以阅读 [
Off the top of my head, I can think of a couple of ways to achieve this, but you''re going to have a problem in that the user may be able to kill your application using the task manager. Most people have a policy, here on Code Project, in not providing an answer on how to prevent the task manager from being shown because, while your purposes may be good, you aren''t the only one who reads this, and we don''t want to help people write malicious software.

Saying that, what are the two methods? Well, the first would be to write an application that was set to be always topmost, and that filled the full screen (or screens if you have multiple monitors) - you could make the background semi-transparent to show some of the screen underneath.

The second method takes advantage of the fact that Windows really has multiple desktops. Basically, you''d take a snapshot of your current desktop, create the new desktop, paste your image onto it, and then display your application over the top. Try combining this with the technique above.

In order to create a new desktop, you could read this[^] article.


这篇关于在用户输入密码之前,如何锁定所有控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆