?
Solved

Disable Keyboard and Mouse which Ctrl+Alt+Del can not Enable them.

Posted on 2005-05-04
10
Medium Priority
?
761 Views
Last Modified: 2010-04-05
Hi

I want to disable keyboard and mouse to avoid a user from using a client, and enable them when the server wants.

I can use BlockInput function from USER32.DLL  but there is a problem. user can easily enable them with pressing Ctrl+Alt+Del , even I deactivate Task Manager (in registry).

I want limit the user not to enable client in any way, untill server allow him/her.


here is my code:
---------------------------------------------------
procedure BlockInput(ABlockInput : boolean); stdcall; external 'USER32.DLL';

procedure TForm1.Button1Click(Sender: TObject);
begin
  BlockInput(True);
  Sleep(5000);
  BlockInput(False);
end;
---------------------------------------------------


and I deactivate Task Manager with modifying this value in registry
---------------------------------------------------
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr = 1
---------------------------------------------------


Thank you for your help.
mehdi_m.
0
Comment
Question by:mehdi_m
  • 5
  • 4
10 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 13932981
Stay away from such idiotic ideas. If your program crashes then the computer becomes unusable.
Your example is also of the worst kind. By sleeping the program does nothing anyway.

How about placing an OnMessage event filter which removes all mouse and keyboard input for your application only?
0
 

Author Comment

by:mehdi_m
ID: 13933707
Sleeping is a sample and I don't use it in my application. I just Lock/Unlock the client program with the server program. Even my program crashes, a restart will be OK.

I want the windows to be locked, in any way. Can you tell me how to use messages to do that, please?  Is it usefull? And aslo does the client program or the whole windows will be locked, with this method?

thank you.
mehdi_m
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 13934596
Of course only the client locks. It simply ignores all input.
Blocking the input of all processes is completely idiotic.
It can also only be done reliably with drivers.

What do you really want to do? A remote admin tool?
If you only want a thin client computerr then use an OS which can be configuerd for that like Linux.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:mehdi_m
ID: 13936809
I have a client-server program ,of course they do many things else. and I want to add the capability of lock/unlock the clients from server too.

I will be glad if you can help me with message handling.

thank you.
mehdi_m
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 13938354
So where is the problem? The server sends a command to the client to stop handling user input.
This is something local to the client and should not affect other processes or the OS.

Have a look at the Application.OnMessage event. All keyboard (WM_KEYDOWN and WM_KEYUP) and mouse messages pass through this event.
There you simply mark the message as already handled and that is all.
0
 

Author Comment

by:mehdi_m
ID: 13943982
But it just disables messages that pass through the Client application form only. and not the whole windows.

I want to limit the user to from using the whole computer, not only from my little client program. Can you give me an example please!!?

mehdi_m
0
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 750 total points
ID: 13944380
It is impossible without a driver which i do not know how to write.
This is the area of remote admin tools.

What do you want to do? From the little bit of information available here i would guess that the basic design is completely flawed.
You want to use Windows which is a multitask OS as a monotask kiosk box.
Windows is specifically designed to not allow blocking of input precisely to always allow to switch tasks.
0
 
LVL 34

Expert Comment

by:Slick812
ID: 13949471
I agree with robert, I do not beleive that your idea (as you so far have described) is any good, and you will have a difficult time doing that, and I beleive that a computer user should have the control of their computer, not some mindless software, I beleive I would just show a warning Form, saying -

WAIT, server is processing data
0
 

Author Comment

by:mehdi_m
ID: 13950112
I guess so that it's imposible. by the way my client-server program is a user accounting program that manage a network for controlling the usage of computers by different users.

So I think, when the user account is finished, there will be no way unless restarting the windows. In any way thank you 2 for your helps and attentions.

mehdi_m

0
 

Author Comment

by:mehdi_m
ID: 13953149
;)  I found the solution myself, it's simple.

just put BlockInput(True) statement in a timer untill the server tell that to stop the timer and BlockInput(False).

 
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question