忽略大多数按键和鼠标事件 [英] Ignore Most Keystrokes and Mouse Events

查看:78
本文介绍了忽略大多数按键和鼠标事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个应用程序,以防止用户如果不首先接受安全协议,则无法使用计算机.从用户的角度来看,它就像一个附加的登录层.

问题:用户登录后,该应用在 上运行,所以我必须进入全屏(轻松状态)并阻止他们按ALT-TAB键切换到其他任何位置,然后打开任务"经理,使用开始键等.

而且该应用必须是独立的,即没有额外的DLL等.

对于那些坚持使用Windows 7的人来说,它在Windows 7中可以很好地工作,而在XP中则可以很好地工作.

我该怎么办?

1)蛮力的丑陋但简单的方法:放入一个计时器,该计时器每十秒 将焦点重置为同意/不同意"按钮,这样用户就没有机会还有其他事情吗?

2)花几个小时编写全局钩子来吃我不想要的任何击键或鼠标单击吗?

3)[我想不出来的其他方式]

你的意见? (或链接到已经这样做的人,这样我就可以偷懒?)

I need to write an app that prevents the user from using the computer if they don''t accept the security agreement first. It''s like an additional logon layer, from the user''s point of view.

The Problem: The app runs after the user logs on, so I have to go full screen (easy) and prevent them from ALT-TABbing to anything else, opening the Task manager, using the Start key, etc.

And the app has to be self-contained, i.e. no extra DLLs, etc.

And work well in Windows 7 and well-enough in XP for those few folks who are stuck with it.

How should I do it?

1) Brute force ugly-but-easy-method: put in a timer that resets the focus to the Agree/Disagree buttons every 10th of a second so the user doesn''t get a chance to do anything else?

2) Spend hours writing global hooks to eat any keystrokes or mouse clicks I don''t want?

3) [some other way I can''t think of]

Your opinion? (Or links to someone who has already done it so I can be lazy?)

推荐答案

使用计算机"与您的应用程序无关,但与操作系统,用户会话和身份验证.如果要阻止登录或强制某人注销,则需要通过登录/注销机制在操作系统级别进行操作.

不管您做什么,都在应用程序级别防止使用计算机.您想在登录前限制用户使用用户自己的计算机的权利 的事实仅仅是滥用无论如何.

合理的用户不会将您的公司视为公平竞争者,也不会处理您的产品.尝试得出您的结论:谁是最宽松的人? :-)

听取良好的友好建议:不要那样做.或在讨论技术细节之前向您详细说明最终目标.

—SA
"Using a computer" is something not related to your application, but to the OS, a user session and authentication. If you want to prevent log in or force a person to log out, you need to do it on the OS level, through the log in / log out mechanism.

Preventing using a computer on the application level would be the abuse, not matter what you do. The mere fact that you want to restrict user''s rights to use the user''s own computer before login is a clear case of abuse anyway.

The reasonable user won''t consider your company as a fair player and won''t want to deal with your products. Try to draw your conclusion: who is the looser? :-)

Listen to the good friendly advice: don''t do anything like that. Or explain your ultimate goals in detail to, before discussing the technical detail.

—SA


我正在使用全局挂钩方法来捕获所有击键,因此只要该应用程序正在运行.
他们绕过它的唯一方法是ctrl-alt-delete进入任务管理器...由于GPO,这对他们来说是不可用的.
I''m using the global hooks method to capture all keystrokes so the user can''t get to anything else on the system as long as the app is running.
The only way they could bypass it would be to ctrl-alt-delete to get to the Task Manager...which is not available to them because of a GPO.


这篇关于忽略大多数按键和鼠标事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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