AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to realize a kind of kiosk-mode?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
buttercheese



Joined: 19 Oct 2004
Posts: 2

PostPosted: Tue Oct 19, 2004 9:44 am    Post subject: How to realize a kind of kiosk-mode? Reply with quote

Hello together,

I want to use AutoHotkey (AutoIt) to avoid pupils leaving a fullscreen application (kiosk-mode). The big problem was the ctrl-alt-del kombination, that made the way out of the kiosk possible. I found the following tool, that can do the job as I want to: http://www.phord.com/keyblock.html

I tested that tool and everything worked fine (XP). Even the virus-scanner had no problems with that tool.

Would be nice to get your opinion, if this could be made using autohotkey to?

Best wishes

buttercheese
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Oct 19, 2004 11:50 am    Post subject: Reply with quote

I believe that disabling Ctrl-Alt-Del completely on NT/2k/XP requires a low-level change to the system. Until I find info to the contrary, such a feature probably won't be added to AutoHotkey. Note however that you can disable virtually any other key this way:

LWin::
RWin::
!Tab::
^Escape:: ; Start menu.
^+Escape:: ; Launches task manager.
return ; i.e. do nothing

Also, you can disable almost every aspect of Ctrl-Alt-Del via Group Policy Editor:

- As an administrator, run gpedit.msc
- Navigate to User Config > Admin Templates > System > Ctrl+Alt+Del options.
- There you can disable various aspects of Ctrl-Alt-Del, including task manager.

I've also read that a change such as the following might be useful for kiosks and such. NOTE: This will completely replace the Explorer desktop with MSIE, so use with caution -- you might lock yourself out of your own system if Ctrl-Alt-Del is also disabled (maybe safe mode can bypass this):
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
Shell --> C:\Program Files\Internet Explorer\iexplore.exe -k www.google.com

Someone on the Usenet also recommended this:
" http://www.schlotsoft.de/data/bin/frmDownload.aspx?filename=apex.zip -- The zip-file contains apex.exe. if you call "apex 1" the buttons in the CTRL+ALT+DEL - menuwindow are disabled; if you call apex 0 the buttons are directly enabled. "


Last edited by Chris on Tue Oct 19, 2004 12:15 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
BoBo
Guest





PostPosted: Tue Oct 19, 2004 12:10 pm    Post subject: Reply with quote

Fixed broken link Arrow
[Download - apex.zip]
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Oct 19, 2004 12:15 pm    Post subject: Reply with quote

Thanks, I fixed it in mine too.
Back to top
View user's profile Send private message Send e-mail
BoBo
Guest





PostPosted: Tue Oct 19, 2004 1:49 pm    Post subject: Reply with quote

To disable C+A+D is always a lill suspicious Rolling Eyes. An expert user will find a way to bypass it. A MSUE (most stupid user ever) wouldn't even know about that combo.

What about if the keymapping of the CTRL key would send whatever char, so you would send nonsense instead of an C+A+D combo ?

Cool
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Oct 19, 2004 2:34 pm    Post subject: Reply with quote

Quote:
What about if the keymapping of the CTRL key would send whatever char, so you would send nonsense instead of an C+A+D combo?
You can't circumvent Ctrl-Alt-Del that way. This is because it's trapped at a very low level, so anything you do at a high level isn't going to fool the system.
Back to top
View user's profile Send private message Send e-mail
buttercheese



Joined: 19 Oct 2004
Posts: 2

PostPosted: Tue Oct 19, 2004 4:04 pm    Post subject: Reply with quote

Hi Chris & BoBo,

Thanx for your explanation and the slotsoft-link.

Have a nice day

buttercheese
Back to top
View user's profile Send private message
savage



Joined: 02 Jul 2004
Posts: 206

PostPosted: Tue Oct 19, 2004 9:57 pm    Post subject: Reply with quote

I could have sworn there was an api call to disable it, I remember using it back when I did vb programming. I can't find it now though.
Back to top
View user's profile Send private message AIM Address
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Oct 19, 2004 10:31 pm    Post subject: Reply with quote

I think it's SPI_screensaver something... but I think it only works on Windows 9x.
Back to top
View user's profile Send private message Send e-mail
K-Lel



Joined: 26 Jun 2004
Posts: 6

PostPosted: Wed Oct 20, 2004 1:18 am    Post subject: Reply with quote

Hello, I´m interesting on this problem

What happen if you write something like this?

#Persistent
If A_OSVersion = WIN_XP
ventanatareas = Task Manager

SetTimer Task_Manager, 2000


Task_Manager:

IfWinExist, %ventanatareas%
if A_OSVersion = WIN_XP
winclose



What do you think about this?
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Wed Oct 20, 2004 2:07 am    Post subject: Reply with quote

It seems like it would close Task Manager whenever it appears? Seems okay, but it's probably a more complete solution to disable it via the registry or group policy editor.
Back to top
View user's profile Send private message Send e-mail
MisterMoonlight
Guest





PostPosted: Mon Jun 06, 2005 9:32 am    Post subject: Disabling Ctl-Alt-Delete Reply with quote

Hi,

On windows NT/200/XP:

Just use the REGWRITE commands in a script and the following keys value to disable all 5 buttons in the CTL-ALT-DEL windows on NT type system.

http://www.windowsnetworking.com/kbase/WindowsTips/Windows2000/AdminTips/Security/DisableWindowsNTalt-ctrl-deldialogbuttons.html

This won't disable the popup windows but user can do nothing with it...
Back to top
daonlyfreez



Joined: 16 Mar 2005
Posts: 745
Location: Berlin

PostPosted: Mon Jun 27, 2005 12:39 am    Post subject: Reply with quote

Here's some code to use:

Disables the 5 unwanted buttons on the Windows Security window (The window you see when you press CTRL + ALT + DELETE)... should work on NT/2k/XP, and disables the keycombo's the user should not be able to use...

Code:
SetBatchLines, -1

; Disable!
SetTo = 1

Keys1 = NoBlock,NoRun,NoSMHelp,NoChangeStartMenu,NoClose,NoLogoff

Loop, PARSE, Keys1,`,
{
   RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\Explorer, %A_LoopField%, %SetTo%
}

Keys2 = DisableTaskMgr,DisableChangePassword,DisableLockWorkstation

Loop, PARSE, Keys2,`,
{
   RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, %A_LoopField%, %SetTo%
}

; disable specific hotkeys

; Win + B (System Tray - XP)
#b::return

; Win + L (Lock workstation - XP, or Log off)
#l::return

; Win + P (Open Print Manager)
#p::return

; Win + C (Open Control Panel)
#c::return

; Win + V (Open Clipboard)
#v::return

; Win + K (Open Keyboard Properties)
#k::return

; Win + I (Open Mouse Properties)
#i::return

; Win + A (Open Accessibility Properties)
#a::return

; Win + Space (Shows Intellitype Shortcut Keys)
#Space::return

; Win + U (Open Utility Manager)
#u::return

; Ctrl + Q (Quit)
^q::return

; Ctrl + W (Close)
^w::return

; Alt + F4 (Close window)
!F4::return

; Ctrl + F4 (Close tab or child-window)
^F4::return

; Win + D (Show Desktop)
#d::return

; Win + E (Run Explorer)
#e::return

; Win + F or Win + F3 (Find all)
#f::return
#F3::return

; Win + Ctrl + F (Find computers)
#^f::return

; F3 (General find)
F3::return

; Win + M (Minimize all windows)
#m::return

; Win + Shift + M (Minimize all windows undo)
#+m::return

; Win + R (Run)
#r::return

; Win + F1 (Help)
#F1::return

; Alt + Tab (Switcher)
!TAB::return

; Alt + Shift + Tab (Switcher reverse)
!+TAB::return

; Win (left and right) or Win + Esc or Ctrl + Esc or Ctrl + Shift + Esc (Start menu)
LWin::return
RWin::return
#ESC::return
^ESC::return
^+ESC::return

; AppsKey (Menu)
AppsKey::return

; Win + Tab (Task switching - special)
#TAB::return

; Win + Shift + Tab (Task switching reverse - special)
#+TAB::return

; Win + Pause (System properties)
#PAUSE::return

; Alt + Esc (Active window to last)
!ESC::return

; Alt + Shift + Esc (Make last window active)
#+ESC::return

; F11 (Toggle full-screen mode)
F11::return


Now all you still need is to do, is force your Kiosk/GUI on top...

Exclamation

This code (an small adaptation to the above first part of the script) will enable the 5 buttons again:

Code:
SetBatchLines, -1

; Enable!
SetTo = 0

Keys1 = NoBlock,NoRun,NoSMHelp,NoChangeStartMenu,NoClose,NoLogoff

Loop, PARSE, Keys1,`,
{
   RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\Explorer, %A_LoopField%, %SetTo%
}

Keys2 = DisableTaskMgr,DisableChangePassword,DisableLockWorkstation

Loop, PARSE, Keys2,`,
{
   RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, %A_LoopField%, %SetTo%
}


But... be careful with this... Exclamation

-----

Ok, here's a 'better' script that should be 'unbreakable'... Razz

Try it, and see if you can break it...

Only the 'Stop' button should...

USE AT YOUR OWN RISK!

(I locked myself out a couple of times while testing... had to force a restart, should be working ok now though)

Works for me on Windows 2000...

Important: You need permittance to write to the registry and a Windows NT/2k/XP version to make the Ctrl+Alt+Delete Window tweaks work...

Code:
#persistent
#singleinstance force
setbatchlines, -1
SetWinDelay, -1

; Variables
Title = Break me!

; Size adaptations for screen dimensions
sh = %a_screenheight%
sh -= 24
sw = %a_screenwidth%
sw -= 5

; ********** SECURITY SETTINGS: **********

; Hide the Desktop:
DetectHiddenWindows, on
WinHide, Program Manager
DetectHiddenWindows, off

; Minimize all:
Send, #m

; Disable them Windows Security Screen (Ctrl + Alt + Delete Screen) buttons:
WinSecurityButtons("off")

; Create the Gui
Gui, +alwaysontop -sysmenu
Gui, Add, Button, x6 y207 w100 h30, Stop
Gui, Add, Text, x6 y7 w320 h190, This is an AutoHotkey script to test 'unbreakable' Kiosk-mode`n`n- Force 'Always on top'`n`n- No 'break' hotkeys`n`n- No 'useable' CTRL+ALT+DELETE combo`n`n`n`nTry to break it`, and let me know if you can!`n`n`nUse the 'Stop' button to exit...
Gui, Show, x0 y0 h%sh% w%sw%, %Title%

; Start forcing window postition and 'on top'
SetTimer, CheckWin, 10

Return

;
; Disable them 'specific' keycombos:
; ---------------------------------------

; Win + B (System Tray - XP)
#b::return

; Win + L (Lock workstation - XP, or Log off)
#l::return

; Win + P (Open Print Manager)
#p::return

; Win + C (Open Control Panel)
#c::return

; Win + V (Open Clipboard)
#v::return

; Win + K (Open Keyboard Properties)
#k::return

; Win + I (Open Mouse Properties)
#i::return

; Win + A (Open Accessibility Properties)
#a::return

; Win + Space (Shows Intellitype Shortcut Keys)
#Space::return

; Win + U (Open Utility Manager)
#u::return

; Ctrl + Q (Quit)
^q::return

; Ctrl + W (Close)
^w::return

; Alt + F4 (Close window)
!F4::return

; Ctrl + F4 (Close tab or child-window)
^F4::return

; Win + D (Show Desktop)
#d::return

; Win + E (Run Explorer)
#e::return

; Win + F or Win + F3 (Find all)
#f::return
#F3::return

; Win + Ctrl + F (Find computers)
#^f::return

; F3 (General find)
F3::return

; Win + M (Minimize all windows)
#m::return

; Win + Shift + M (Minimize all windows undo)
#+m::return

; Win + R (Run)
#r::return

; Win + F1 (Help)
#F1::return

; Alt + Tab (Switcher)
!TAB::return

; Alt + Shift + Tab (Switcher reverse)
!+TAB::return

; Win (left and right) or Win + Esc or Ctrl + Esc or Ctrl + Shift + Esc (Start menu)
LWin::return
RWin::return
#ESC::return
^ESC::return
^+ESC::return

; AppsKey (Menu)
AppsKey::return

; Win + Tab (Task switching - special)
#TAB::return

; Win + Shift + Tab (Task switching reverse - special)
#+TAB::return

; Win + Pause (System properties)
#PAUSE::return

; Alt + Esc (Active window to last)
!ESC::return

; Alt + Shift + Esc (Make last window active)
#+ESC::return

; F11 (Toggle full-screen mode)
F11::return

; ---------------------------------------

; Disable close and escape
GuiClose:
GuiEscape:
return

; --- This should be the only way to stop it:
ButtonStop:

; Enable buttons
WinSecurityButtons("")

; Enable Desktop
DetectHiddenWindows, on
WinShow, Program Manager

; Minimize all undo:
Send, #+m

; Done, so exit...
ExitApp

; ***** Functions - Routines *****

; --- Keep the window where it is...
CheckWin:
WinActivate, %Title%
WinMove, %Title%,, 0, 0
Return
; ---

; --- Disable/enable Windows Security Window buttons...
WinSecurityButtons(toggle)
{
   If toggle = off
   {
      SetTo = 1
   }
   else
      SetTo = 0
   ; Edit Registry
   Keys1 = NoBlock,NoRun,NoSMHelp,NoChangeStartMenu,NoClose,NoLogoff
   Loop, PARSE, Keys1,`,
   {
      RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\Explorer, %A_LoopField%, %SetTo%
   }
   Keys2 = DisableTaskMgr,DisableChangePassword,DisableLockWorkstation
   Loop, PARSE, Keys2,`,
   {
      RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, %A_LoopField%, %SetTo%
   }
   return
}

_________________
(sorry, homesite offline atm)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Mon Jun 27, 2005 3:41 am    Post subject: Reply with quote

Great presentation and research. This looks like it will be useful because the question of how to do kiosks and alternate desktops seems to come up fairly often.

By the way, I merged the your first post in with the second in case you want to edit and remove obsolete sections.
Back to top
View user's profile Send private message Send e-mail
daonlyfreez



Joined: 16 Mar 2005
Posts: 745
Location: Berlin

PostPosted: Mon Jun 27, 2005 9:36 am    Post subject: Reply with quote

Thanks Chris, and thanks for the merging... (this happens every now and then, get logged out without knowing and post Razz )

Found this code (VB). A method that uses the SystemParametersInfo API function to tell the system a screen saver is running:

Code:
Declarations:

Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
 
Code:

Sub DisableCtrlAltDelete(bDisabled As Boolean)
Dim X As Long
X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
 
Use:

To disable Ctrl-Alt-Delete:
 Call DisableCtrlAltDelete(True)

To enable Ctrl-Alt-Delete:
Call DisableCtrlAltDelete(False)


and

Code:
DECLARE SystemParametersInfo IN USER32 ;
INTEGER uAction, ;
STRING uParam, ;
INTEGER lvParam, ;
INTEGER FuWinini

=SystemParametersInfo(97,"1",1,0)


This apparently works on Windows 95, 98 (ME?) but not on NT, 2k and XP

Then I found these (VB) code snippet, that look (even more) dangerous:

Code:
You can disable Ctrl-Alt-Del on NT and 2K but this is very risky. It can prevent you from ever being able to log on again!

Be sure to enable Automatic Logon by specifying DefaultDomainName, DefaultUserName, DefaultPassword and AutoAdminLogin in the registry under Windows Login. Otherwise you will not be able to logon again. See Knowledge Base article Q114615 for details

After you set up automatic logon the logon dialog no longer appears at startup. You are then unable to logon as a different user until the automatic logon and below code is disabled in the registry. You may be able to temporarily bypass the automatic logon by holding down the Shift key as windows is starting

-----

Public Sub SetupScancodeMap()
Dim bArray(1 To 48) As Byte

On Error Resume Next
If g_bDebugMode = True Then Exit Sub
'
' Setup the keyboard scancode mapping to disable the Windows keys
' and Context menu keys
'
bArray(1) = &H0
bArray(2) = &H0
bArray(3) = &H0
bArray(4) = &H0

bArray(5) = &H0
bArray(6) = &H0
bArray(7) = &H0
bArray(8) = &H0
'
' Number of keys
'
bArray(9) = &H6
bArray(10) = &H0
bArray(11) = &H0
bArray(12) = &H0
'
' Windows key
'
bArray(13) = &H0
bArray(14) = &H0
bArray(15) = &H5B
bArray(16) = &HE0
'
' Windows key
'
bArray(17) = &H0
bArray(18) = &H0
bArray(19) = &H5C
bArray(20) = &HE0
'
' Windows menu key
'
bArray(21) = &H0
bArray(22) = &H0
bArray(23) = &H5D
bArray(24) = &HE0
'
' F10 key
'
bArray(25) = &H0
bArray(26) = &H0
bArray(27) = &H44
bArray(28) = &H0
'
' Left Ctrl-key
'
bArray(29) = &H0
bArray(30) = &H0
bArray(31) = &H1D
bArray(32) = &H0
'
' Left Alt-key
'
bArray(33) = &H0
bArray(34) = &H0
bArray(35) = &H38
bArray(36) = &H0
'
' Right Ctrl-key
'
bArray(37) = &H0
bArray(38) = &H0
bArray(39) = &H1D
bArray(40) = &HE0
'
' Right Alt-key
'
bArray(41) = &H0
bArray(42) = &H0
bArray(43) = &H38
bArray(44) = &HE0
'
' Null terminator
'
bArray(45) = &H0
bArray(46) = &H0
bArray(47) = &H0
bArray(48) = &H0
'
' Set the new registry value, does not take effect until the next reboot.
' You can use my registry module or your own routine to write the value to the registry.
'
Reg_SetKeyValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Keyboard
Layout", "Scancode Map", bArray, REG_BINARY
End Sub


and

Code:
Option Explicit

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public Const HC_ACTION = 0
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const WM_SYSKEYDOWN = &H104
Public Const WM_SYSKEYUP = &H105
Public Const VK_TAB = &H9
Public Const VK_CONTROL = &H11
Public Const VK_ESCAPE = &H1B

'//-----------------------------------------------------------------------------//
' The Delete key below is the address I am missing.
'Public Const VK_DELETE = I do not know
'//-----------------------------------------------------------------------------//

Public Const WH_KEYBOARD_LL = 13
Public Const LLKHF_ALTDOWN = &H20

Public Type KBDLLHOOKSTRUCT
vkCode As Long
scanCode As Long
flags As Long
time As Long
dwExtraInfo As Long
End Type

Dim p As KBDLLHOOKSTRUCT

Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim fEatKeystroke As Boolean

If (nCode = HC_ACTION) Then
If wParam = WM_KEYDOWN Or wParam = WM_SYSKEYDOWN Or wParam = WM_KEYUP Or wParam = WM_SYSKEYUP Then
CopyMemory p, ByVal lParam, Len(p)
fEatKeystroke = _
((p.vkCode = VK_TAB) And ((p.flags And LLKHF_ALTDOWN) <> 0)) Or _
((p.vkCode = VK_CONTROL) And ((p.flags And LLKHF_ALTDOWN) <> 0)) Or _
((p.vkCode = VK_ESCAPE) And ((p.flags And LLKHF_ALTDOWN) <> 0)) Or _
((p.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And &H8000) <> 0))
End If
End If

If fEatKeystroke Then
LowLevelKeyboardProc = -1
Else
LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
End If
End Function
'//---------End of Program Code--------------------------------------------//


In the code above I am blocking the ALT-CTRL-TAB key combinations but lack the
key one I need the Delete key. I have a simple form with a checkbox allowing me to
enable and disable the keystroke filter, and it works.


The mechanics of this is:
For Windows NT SP3 (or higher), Microsoft introduced a new hook: WH_KEYBOARD_LL. This hook is called the low-level hook because it is notified of keystrokes just after the user enters them and before the system gets a chance to process them. This hook has a serious drawback: the thread processing the hook filter function could enter an infinite loop or hang. If this happens, then the system will no longer process keystrokes properly and the user will become incredibly frustrated. To alleviate this situation, Microsoft places a time limit on low-level hooks. When the system sends a notification to a low-level keyboard hook’s filter function, the system allows that function a fixed amount of time to execute. If the function does not return in the allotted time, the system ignores the hook filter function and processes the keystroke normally. The amount of time allowed (in milliseconds) is set via the LowLevelHooksTimeout value under the following registry subkey: HKEY_CURRENT_USER\Control Panel\Desktop.


and

Code:
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Const WH_KEYBOARD_LL = 13
Public Const VK_RWIN = &H5B
Public Const VK_LWIN = &H5C
Public Type HOOKSTRUCT
vkCode As Long
scanCode As Long
flags As Long
time As Long
dwExtraInfo As Long
End Type
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As Any, Source As Any, ByVal Length As Long)

Public Function KeyboardLowLevelProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim p As HOOKSTRUCT ' variable pour récupérer le vk code
If idHook < 0 Then
KeyboardLowLevelProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'copie la structure de lParam
CopyMemory p, ByVal lParam, Len(p)
If p.vkCode = VK_RWIN Then ' si c la touche windows de droite ???
KeyboardLowLevelProc = -1 ' on fait croire au système que la touche n'a pas été pressée
Exit Function ' on ne passe pas au hook suivant
End If
KeyboardLowLevelProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function

Private Sub Form_Load()
hHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf KeyboardLowLevelProc, App.hInstance, 0&)
End Sub

Private Sub Form_Unload(Cancel As Integer)
UnhookWindowsHookEx hHook
End Sub


Err, now I'm no coder, and am hesitant to experiment with such a 'tricky' subject.

Would be interesting though to get it working (both on 9x and NTish systems)...

Can anyone convert these codes into a working AutoHotkey DllCall() routine/function? Is anyone willing to give it a try?
_________________
(sorry, homesite offline atm)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group