ken82m Posted November 30, 2008 Share Posted November 30, 2008 (edited) I've been working on a custom shutdown interface and I almost have it doneI know I can't shutdown CTL+ALT+DEL nor do I want to I've set the script to exit when task manager opens.But I do want to stop alt+tab if I can. things go a little screwy if hit it.This is the existing code:Func _Key_Proc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($ah_Hooks[3], $nCode, $wParam, $lParam) Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") If StringInStr($ah_Hooks[0], "|0x" & Hex($vkCode, 2) & "|") Then Return 1 _WinAPI_CallNextHookEx($ah_Hooks[3], $nCode, $wParam, $lParam) EndFuncI changed it to this:Func _Key_Proc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($ah_Hooks[3], $nCode, $wParam, $lParam) Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") ;Added================ Local $flags = DllStructGetData($KBDLLHOOKSTRUCT, "flags") Local $scanCode = DllStructGetData($KBDLLHOOKSTRUCT, "scanCode") ;==================== If StringInStr($ah_Hooks[0], "|0x" & Hex($vkCode, 2) & "|") Then Return 1 _WinAPI_CallNextHookEx($ah_Hooks[3], $nCode, $wParam, $lParam) EndFuncHere's the result from microsoft's SPY++ tool:<00001> 00051004 P WM_SYSKEYDOWN nVirtKey:VK_MENU cRepeat:1 ScanCode:38 fExtended:0 fAltDown:1 fRepeat:0 fUp:0<00002> 00051004 P WM_KEYUP nVirtKey:VK_MENU cRepeat:1 ScanCode:38 fExtended:0 fAltDown:0 fRepeat:1 fUp:1But I'm not sure how to use that informattion to return 1 under that condition here.Thanks,Kenny Edited November 30, 2008 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
ken82m Posted November 30, 2008 Author Share Posted November 30, 2008 I tried this adding a file write line like this:FileWriteLine("C:\key.txt", $scanCode)I got a 15 and 56 from alt-tabIf $scanCode = 15 Then Return 1So added this but had not effect:If $scanCode = 56 Then Return 1Then I tried this:If $scanCode = 15 Then Return 1It definitely stopped alt-tab but when the script exited alt seemed to stuck down or continuely being hit.I couldn't type anything and if I hit the space bar it would bring up the (restore/close/maximize) menu.I could normally get the menu by pressing and releasing alt and then hitting the space bar.Without that line everything is fine.Any ideas?Kenny "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
ken82m Posted November 30, 2008 Author Share Posted November 30, 2008 (edited) I got it, did a FileWriteline for Hex($vkCode, 2) It gave me 0xA4 and 0x09. Blocking 0xA4 did nothing. But blocking 0x09 did what I wanted, killed ALT-TAB, and no keys are stuck. Although it also blocks tab by itself but I can live with that, and CTRL+ALT+DEL till works so that works for me. Kenny Edited November 30, 2008 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now