Hi all,
I am writing a program that is supposed to lock a user from the common key presses, i.e. Alt + F4, Crtl+Alt+Del, etc. I know I have to have
case WM_KEYDOWN:
switch(wParam)
{
//The Keypresses
}
break;
My problem is that I do not know how to halt the keys from doing anything. I am certain that VK_F4 is for the F4 key, but how do I link alll of the keypresses of one command together, i.e. the keypresses for the Task Manager. I also need to know how to make the window, that will disappear, to keep windows from using these keypresses. And last but not least, if anyone could tell me how to keep the window the focus the whole time it is shown. For example, the window has a username and password screen, and I was wondering how am I to keep this window from disappearing pre-maturely. I want it so the window goes away after the username and password have been verified. Thank you in advanced.
C.Timko

Halting Keypresses?
sambar
http://www.windowsnetworking.com/kbase/WindowsTips/WindowsXP/UserTips/Customization/EnableDisableTaskManagerinWindowsXPHomePro.html
Read a book about Windows Server Administration. You can block all this stuff directly from the server via Group Policies.
http://msdn.microsoft.com/library/default.asp url=/library/en-us/policy/policy/group_policy_reference.asp
pdq2
AGK
First of all. Using a keyboard hook would be a good solution. Just search the MSDN for SetWindowsHookEx. You need a system wide hook.
BUT!!! It is not possible to block Ctrl+Alt+Del, because this keyboard sequence is owned by the GINA.
Niranjan80
C.Timko
WendellB
This is also called injecting! If your hook is unstable, every windows program can fail, due to a simple hook.
Read this about GINA:
http://msdn.microsoft.com/library/en-us/secauthn/security/winlogon_and_gina.asp
There is a sample code of a GINA replacement here:
http://www.codeproject.com/useritems/GINA_SPY.asp
But be careful. You might make your system unusable.
My hint: Use Windows Policies to suppress the task manager. This is no problem at all. You do not need to code anything!
DawnJ
I did the following:
HHOOK hKeyboard;
...
hKeyboard = SetWindowsHookEx(WH_KEYBOARD,0,NULL,0);
...
UnhookWindowsHookEx(hKeyboard);
...//EOF
I understand why, but I am coming across a dilema. Where I put the first 0, it says in MSDN "Pointer to the hook procedure. If the dwThreadId(the last 0) parameter is zero or specifies the identifier of a thread created by a different process,...,lpfn(my first 0) can point to a hook procedure in the code associated with the current process." Could you make some sense out of this for me. I am really confused. I have read several c++ books and I now what pointers are and what hooks are, but I dont think it is very clear. Also, what is GINA. I can't block Crtl+Alt+Delete for security reasons. (The kids in our school use the taskmanager to close the Syncroneyes Program that watches over the computers.) Is it just possible to block the taskmanager so it can't execute unless they are administrators Thank you for your help so far.
C.Timko
skeize
I understand that you mean well, and I know that that will work, but let me explain myself some more. The full description of what I am supposed to make:
1) A program with a login screen for a students username and password.
2) Program MUST disable the log-out window and the shutdown window.
3) All system prefernces are to be disabled.
4) All "harmful" keypresses disabled. (i.e. Crtl+Alt+Del, Alt+F4, Esc, etc)
5) Disallowed access to the internet if they are not registered for it.
6) Disallowed access to the C:\
7) Records the amount of time a user is logged in.
8) IF administrator logs in under their username, all of the above are released for their usage.
9) If the program crashes the computer will auto restart.
10) Checks username and pass with an ODBC db
My high school has made this a learning time for me. My deadline is on Nov 17. Also our school is really behind in technology and is unable to issue groups via a server, because we only have 2 and the harddrives are really small.
C.Timko
Miha Markic
@Timko!
Everything you want ist just a matter of group policies and rights in a domain!
Except one: But why shouldn't say logout
Rohidas K