May 10, 2024, 11:41:50 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


CTRL+ALT+DEL and ALT+F4 disable ?

Started by paja, February 12, 2010, 05:28:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

paja

February 12, 2010, 05:28:11 PM Last Edit: February 12, 2010, 05:31:18 PM by paja
Hi.

How can I disable from program  keyboard control combination "CTRL+ALT+DEL" and "ALT+F4" ?

Thanks

Doc

Quote from: paja on February 12, 2010, 05:28:11 PM
Hi.

How can I disable from program  keyboard control combination "CTRL+ALT+DEL" and "ALT+F4" ?

Thanks


I certainly hope that I do not offend or cast a shadow of "evil intent" your direction, but I wouldn't want a program with those capabilities to be found anywhere on my computer. Nor can I think of any good reasoning to add such.

Smileys go here to show that I'm not trying to be mean spirited or cause a problem. :) :) :)
...rather just a very specific point of view.  ;D

-Doc-

ZeroDog

February 14, 2010, 06:47:57 AM #2 Last Edit: February 15, 2010, 04:47:52 AM by ZeroDog
sometimes you want to be able to control the ability to close the running program, or prevent the task manager from being accessed.  A good example of this is a kiosk.  You dont want people having access to anything but the kiosk software that is running.

There is a good article here on how to do it.  Its in c++ but the theory is the same for EBasic.


EDIT:fixed link oops !

Doc

Quotesometimes you want to be able to control the ability to close the running program, or prevent the task manager from being accessed.

Which is true... 
However, for most of the questions I've seen such as this over the years, it seems there is all too often, ill intentions (like a mean prank or even worse) involved. I stand corrected.

I apologize if I sounded too harsh, paja.   :-[

-Doc-

paja


Copex

-
I really should learn how to use a spell checker! though im not sure how it will help someone who can not spell?
-
Except where otherwise noted, content Posted By Copex is
licensed under a Creative Commons Attribution 3.0 License

http://creativecommons.org/licenses/by/3.0/

pistol350

I found this sample code that may be very useful for what you're trying to accomplish :
It's about low level hooks

$include "windows.inc"

type KBDLLHOOKSTRUCT
   int vkCode
   int scanCode
   int flags
   int time
   pointer dwExtraInfo
endtype

const LLKHF_ALTDOWN = (0x2000 >> 8)
const WH_KEYBOARD_LL = 13

'LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
'   WPARAM wParam, LPARAM lParam) {
sub LowLevelKeyboardProc(nCode:int, wParam:uint, lParam:pointer)

'   bool fEatKeystroke = FALSE;
   int fEatKeystroke = false

'   if (nCode == HC_ACTION) {
   if (nCode = HC_ACTION)
'      switch (wParam) {
      select (wParam)
'      case WM_KEYDOWN:  case WM_SYSKEYDOWN:
'      case WM_KEYUP:    case WM_SYSKEYUP:
      case WM_KEYDOWN
      case& WM_SYSKEYDOWN
      case& WM_KEYUP
      case& WM_SYSKEYUP
'         PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
         KBDLLHOOKSTRUCT p : p = *<KBDLLHOOKSTRUCT>lParam
         
'         fEatKeystroke =
'            ((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0)) ||
'            ((p->vkCode == VK_ESCAPE) &&
'            ((p->flags & LLKHF_ALTDOWN) != 0)) ||
'            ((p->vkCode == VK_ESCAPE) && ((GetKeyState(VK_CONTROL) &
'             0x8000) != 0)) ||
'             ((p->vkCode == VK_DELETE) ((GetKeyState(VK_CONTROL) &
'             0x8000) != 0) && (p->flags & LLKHF_ALTDOWN != 0)) ;
         fEatKeystroke = _
            ((p.vkCode = VK_TAB) and ((p.flags & LLKHF_ALTDOWN) <> 0)) or _
            ((p.vkCode = VK_ESCAPE) and ((p.flags & LLKHF_ALTDOWN) <> 0)) or _
            ((p.vkCode = VK_ESCAPE) and ((_GetKeyState(VK_CONTROL) & 0x8000) <> 0)) or _
((p.vkCode = VK_DELETE) and ((_GetKeyState(VK_CONTROL) & 0x8000) <> 0) and (p.flags & LLKHF_ALTDOWN) <> 0)
'         break;
'      }
      endselect
'   }
   endif
   if (fEatKeystroke) then return 1 else return _CallNextHookEx(NULL, nCode, wParam, lParam)
'   return(fEatKeystroke ? 1 : CallNextHookEx(NULL, nCode, wParam,
'          lParam));
'}
endsub

'/////////////////////////////////////////////////////////////////////////


'int WINAPI WinMain(HINSTANCE hinstExe, HINSTANCE, PTSTR pszCmdLine, int) {

'   // Install the low-level keyboard & mouse hooks
'   HHOOK hhkLowLevelKybd  = SetWindowsHookEx(WH_KEYBOARD_LL,
'      LowLevelKeyboardProc, hinstExe, 0);
   int hhkLowLevelKybd
   hhkLowLevelKybd = _SetWindowsHookEx(WH_KEYBOARD_LL, &LowLevelKeyboardProc, _GetModuleHandle(NULL), 0)

'   // Keep this app running until we're told to stop
'   MessageBox(NULL,
'      TEXT("Alt+Esc, Ctrl+Esc, and Alt+Tab are now disabled.\n")
'      TEXT("Click \"Ok\" to terminate this application and re-enable
'            these keys."),
'      TEXT("Disable Low-Level Keys"), 4);
   messagebox(Null, "Alt+Esc, Ctrl+Esc, Alt+Tab and Ctrl+Alt+Del are now disabled.\n" + _
      "Click \"Ok\" to terminate this application and re-enable these keys.", "Disable Low-Level Keys", 0)
   _UnhookWindowsHookEx(hhkLowLevelKybd)

'   return(0);
'}
'#endif
Regards,

Peter B.

paja

Ctrl+Alt+Del  + key "WINDOWS" do not work still. Other yes. I have WIN 7 64 bit