title: Can task-switching keyboard shortcuts be disabled in W7 using Delphi?
body: <p>MY application has had a mode for years where the customer can 'disable access to the OS'. Obviously this feature goes against the grain (at least as far as Windows is concerned) but there are installations where my App is the only program that should ever be visibile to a machine operator amd in this case such a feature is useful.</p>
  
  <p>The technigue I used was built from several 'layers':</p>
  
  <ol>
  <li>Hide the taskbar and button.</li>
  <li>Disable task-switching.</li>
  <li>Disable my main form system icons.</li>
  </ol>
  
  <p>To disable the taskbar I used:</p>
  
  <pre><code>// Get a handle to the taskbar and its button..
  Taskbar := FindWindow('Shell_TrayWnd', Nil);
  StartButton := FindWindow('Button', Nil);
  
  // Hide the taskbar and button
  if Taskbar &lt;&gt; 0 then
    ShowWindow( Taskbar, SW_HIDE );
  if StartButton &lt;&gt; 0 then
    ShowWindow( StartButton, SW_HIDE );
  
  // Set the work area to the whole screen
  R := Rect( 0,0,Screen.Width,Screen.Height );
  SystemParametersInfo(
    SPI_SETWORKAREA,
    0,
    @R,
    0 );
  </code></pre>
  
  <p>This worked well and still seems fine on W7.
  Researching how to disable task-switching some years ago turned up the only technique of 'pretending' that your App is a screen saver (other than terrible things like renaming your app to 'explorer.exe' and booting into it etc):</p>
  
  <pre><code>procedure EnableTaskSwitching( AState : boolean );
  // Enables / disables task switching
  begin
    SystemParametersInfo(
      SPI_SCREENSAVERRUNNING,
      Cardinal( not AState),
      nil,
      0 );
  end;
  </code></pre>
  
  <p>Not surprisingly this seems to have no effect in W7 (I think it works in XP etc).
  Does anyone know of another, better, way of enabling / disabling Alt-Tab (and other special windows keys) from working?</p>