Hi,
I am trying to find a way to disable / enable the Alt + Tab function
Basically, I have a password screen and I don't want a user to use the Alt + Tab function to bypass this screen and tab to another screen.  
I want to disable the ALt + Tab function here, but after the user either enters a password or closes the screen then I would like the ALt + Tab function to be re-enabled
There is a way in XP, it's a registry settings called 'CoolSwitching' but it doesn't work in Vista or Win 7
Can anyone help please ?
Happy Easter,
Andy.
 
			
			
			
				Andy, try switching desktop to a custom one, like winlogon does:
$include "windowssdk.inc"
'$include "stdafx.inc"
' example usage
RunInSecureDesktop(0, &MySecureFunction, 0, 20000/*INFINITE*/)
' another example
$if 0
UINT function_result
if (!RunInSecureDesktop(0, &MySecureFunction, 0, 20000/*INFINITE*/, &function_result))
	' failure
else
	print function_result
endif
$endif
' a function running on separate desktop, in separate thread
sub MySecureFunction(pointer parameter),uint
	' please do not crash here
	' to do: open login window here, use WAITUNTIL ...
	MESSAGEBOX 0, "Check what ALT+TAB does", "on secure desktop"
	return 0
endsub
'==================================================
sub RunInSecureDesktop(int reserved, LPTHREAD_START_ROUTINE function, pointer parameter, DWORD dwTimeout,opt pointer pResult),BOOL
	BOOL result = FALSE
	HDESK hCurrentDesktop = GetThreadDesktop(GetCurrentThreadId())
	HDESK hSecureDesktop = CreateDesktop(T"MyAppLoginDesktop",NULL,NULL,0/*DF_ALLOWOTHERACCOUNTHOOK*/,GENERIC_ALL,NULL)
	if (hSecureDesktop)
		DWORD dwThreadId
		reserved = static_cast(int, hSecureDesktop)
		HANDLE hThread = CreateThread(0,0,&ThreadLauncher,&reserved,CREATE_SUSPENDED,&dwThreadId)
		if (hThread)
			'SwitchDesktop(hSecureDesktop) ' error: SetThreadDesktop must be called first
			ResumeThread(hThread)
			DWORD dwWaitResult = WaitForSingleObject(hThread, dwTimeout)
			result = !dwWaitResult
			if (dwWaitResult == WAIT_TIMEOUT)
				TerminateThread(hThread, 1)
			endif
			' switch desktop to
			SwitchDesktop(hCurrentDesktop)
			CloseHandle(hThread)
		endif
		CloseDesktop(hSecureDesktop)
	endif
	return result
endsub
type MYDATA
	HDESK hSecureDesktop
	LPTHREAD_START_ROUTINE function
	pointer parameter
	DWORD   dwTimeout
	pointer pResult
endtype
declare THFN(pointer parameter),uint
sub ThreadLauncher(MYDATA d ByRef),uint
	UINT result=1
	SetThreadDesktop(d.hSecureDesktop)
	SwitchDesktop(d.hSecureDesktop)
	try
		UINT fn = d.function
		result = !<THFN>fn(d.parameter)
	endtry
	if (d.pResult) then d.*<uint>pResult = result
	return result
endsub
			
			
			
				Thanks sapero,
will give it a go many thanks.
Andy.