1) First point - you should not prevent users from "Alt-Tab"-bing
2) Second isssue - WinNT based OS'es will not let you prevent user from AltTab

Now how to correcly handle Alt-Tabbing, Printer Box pop-up's, Fast User switching, Suspendig, etc...

Yes, WM_ACTIVATEAPP in most cased will do the trick, but to ensure what your suggestion is correct you should check result of Present/Blit/Flip function for "device lost" situation.

Code snippet below is from D3D9 render procedure code:
[pascal][background=#FFFFFF][normal=#000000][number=#0000FF][string=#0000FF][comment=#248F24][reserved=#000000] function Render3DEnvironment: HRESULT;
var
...
begin
if fDeviceLost then
begin
// Test the cooperative level to see if it's okay to render
Result := D3DDevice.TestCooperativeLevel;
if FAILED(Result) then
begin
// If the device was lost, do not render until we get it back
if (D3DERR_DEVICELOST = Result) then
begin
Result := S_OK;
Exit;
end;

// Check if the device needs to be reset.
if (D3DERR_DEVICENOTRESET = Result) then
begin
// If we are windowed, read the desktop mode and use the same format for
// the back buffer
if fWindowed then
begin
// Setup back buffer format
...
end;

Result:= Reset3DEnvironment; // inside this function we call to D3DDevice.Reset
if FAILED(Result) then Exit;
end;
Exit;
end;
fDeviceLost := False;
end;
...
// Render the scene as normal
Result := Render;
if FAILED(Result) then Exit;
...
// Show the frame on the primary surface.
Result:= m_pd3dDevice.Present(nil, nil, 0, nil);
if (D3DERR_DEVICELOST = Result) then fbDeviceLost := True;

Result := S_OK;
end;[/pascal]
Code from D3DFramework: http://clootie.narod.ru/delphi/downl...l#D3Dex_Common