View Single Post
  #18  
Old 09-03-2013, 10:49
ontryit ontryit is offline
Friend
 
Join Date: Nov 2011
Posts: 172
Rept. Given: 127
Rept. Rcvd 17 Times in 14 Posts
Thanks Given: 439
Thanks Rcvd at 70 Times in 43 Posts
ontryit Reputation: 17
Quote:
Originally Posted by BoB View Post
Hi, you can create a new desktop object, which avoids Alt + Tab, Ctrl + Alt + Del ..

Code:
hOldThreadDesktop := GetThreadDesktop(GetCurrentThreadId);
hOldInputDesktop := OpenInputDesktop(0, FALSE, DESKTOP_CREATEWINDOW + DESKTOP_SWITCHDESKTOP);
hLockedDesktop := CreateDesktop('LockedDesktop', nil, nil, 0, DESKTOP_CREATEWINDOW + DESKTOP_SWITCHDESKTOP, nil);
SetThreadDesktop(hLockedDesktop);
SwitchDesktop(hLockedDesktop);
..Then run your application within that new desktop ..

Code:
SI.cb := SizeOf(StartupInfo);
SI.lpDesktop := PChar('LockedDesktop');
If CreateProcess(nil, 'YourApp.exe', nil, nil, True, 0, nil, nil, SI, PI) Then
  WaitForSingleObject(PI.hProcess, INFINITE);
..And when your app exits, return to 'real' desktop ..

Code:
if hOldInputDesktop <> 0 then SwitchDesktop(hOldInputDesktop);
if hOldThreadDesktop <> 0 then SetThreadDesktop(hOldThreadDesktop);
if hLockedDesktop <> 0 then CloseDesktop(hLockedDesktop);

See Desktops @ MSDN

Have fun!
BoB
This solution was recommended by Microsoft but only for XP, you need to add a code to avoid taskmgr from shown on the default desktop when the the ctrl+alt+del/ctrl+shift+esc keys was pressed on xp in order to not make it suspiously looking. on W7 this solution can't be disable ctrl+alt+del keys
Reply With Quote