まぁそれはそれでいいのですが、アプリケーションがこの状態から復帰したときに、(1)Zオーダが狂ってしまい、直後の最前面ウィンドウ表示が最背面に回されてしまう、(2)Windows Vistaのタスクバーにゴーストウィンドウが残ってしまう、という微妙な(状況によっては厄介な)問題があります。
そこでウィンドウゴースト機能を停止してしまえ、ということでDisableProcessWindowsGhostingのサンプルコードです。
uses Windows, SysUtils; procedure DisableProcessWindowsGhosting; var PDisableProcessWindowsGhosting: procedure; stdcall; begin if (Win32Platform = VER_PLATFORM_WIN32_NT) and (((Win32MajorVersion = 5) and (Win32MinorVersion >= 1)) or // Windows XP (Win32MajorVersion >= 6)) then // Windows Vista or later begin @PDisableProcessWindowsGhosting := GetProcAddress(GetModuleHandle('user32.dll'), 'DisableProcessWindowsGhosting'); if Assigned(PDisableProcessWindowsGhosting) = True then begin PDisableProcessWindowsGhosting; end; end; end;
元ねたはCodeGearのQC3730から。
2011/05/04追記: QC3730のリンクをqc.embarcadero.comのものに差し替え。
0 件のコメント:
コメントを投稿