-
November 12th, 2003, 08:14 PM
#1
Any way to disable the 'Print Screen' key?
Is there a way to disable the 'Print Scrn' key to prevent screen capturing?
-
November 12th, 2003, 09:08 PM
#2
Yep there sure is a way to disable the print screen key. You can do it using low level keyboard hooks. Here is the code to disable the print screen key.
Hope this helps!
Cheers,
Greg
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
typedef UINT (CALLBACK* LPREGISTERSERVICEPROC)(DWORD,DWORD);
HHOOK hhkLowLevelKybd;
LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam) {
BOOL fSuppressKeystroke = FALSE;
if (nCode == HC_ACTION) {
switch (wParam) {
case WM_KEYDOWN: case WM_SYSKEYDOWN:
case WM_KEYUP: case WM_SYSKEYUP:
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
fSuppressKeystroke = ((p->vkCode == VK_SNAPSHOT));
break;
}
}
return(fSuppressKeystroke ? 1 : CallNextHookEx(NULL, nCode, wParam, lParam));
}
//Call this when you want to start capturing the printscreen key
hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, hInstance, 0);
//call this to stop disabling the print screen key
UnhookWindowsHookEx(hhkLowLevelKybd);
-
November 13th, 2003, 02:04 AM
#3
a perfect answer!
-
November 13th, 2003, 05:03 AM
#4
Thanks for the help.
The code is for NT/2K/XP, how about Win9x ?
I changed the parameter from WH_KEYBOARD_LL to WH_KEYBOARD and it doesn't work in Win9x.
Last edited by Kurosan; November 13th, 2003 at 05:08 AM.
-
November 13th, 2003, 09:40 AM
#5
oooh... windows9x...
I am at work right now, and we don't have any windows 9x boxes around here anymore
I have some win 9x machines at home, so when I get home I will try to see if I can get you a solution for win 9x.
Cheers,
Greg
-
November 18th, 2003, 01:17 PM
#6
I haven't tried it yet, but to disable the print screen key in windows 98 you might try registering that key as a hotkey and just make it do nothing.
You could check out this article
http://www.codeproject.com/system/nishhotkeys01.asp
Cheers,
Greg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|