View Single Post
  #16  
Old 09-03-2013, 08:15
BoB's Avatar
BoB BoB is offline
Lo*eXeTools*rd
 
Join Date: Jun 2009
Location: England
Posts: 85
Rept. Given: 88
Rept. Rcvd 56 Times in 24 Posts
Thanks Given: 2
Thanks Rcvd at 2 Times in 2 Posts
BoB Reputation: 56
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
Reply With Quote