スクリーンショット
上記のエラーを生成するために、次のソースコードが使用されました。プログラムをコンパイルし、IDEがまだ実行されていることを確認するだけです(IDEを閉じてもエラーは発生しません)。ボタンを12〜15回クリックすると、エラーがポップアップ表示されます。
エラーが発生したら、IDEに戻り、IDEのすべてのツールバーが消えます。IDEを再表示するには、IDEをシャットダウンして再度実行する必要があります。
ソースコード
unit MainUnit;
interface
uses
Winapi.Windows, Winapi.Messages, Winapi.ShlObj, System.SysUtils,
System.Variants, System.Classes, System.StrUtils, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.StdCtrls;
type
TMainFrm = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainFrm: TMainFrm;
hDesktop: HWND;
implementation
{$R *.dfm}
function GetHandle(theHandle: HWND; NotUsed: NativeInt): LongBool; stdcall;
begin
if (theHandle <> 0) then
begin
hDesktop := FindWindowEx(FindWindowEx(theHandle, 0, 'SHELLDLL_DefView',
nil), 0, 'SysListView32', nil);
end;
Result := (hDesktop = 0);
end;
procedure TMainFrm.FormCreate(Sender: TObject);
var
lpss: TShellState;
begin
ZeroMemory(@lpss, SizeOf(lpss));
try
SHGetSetSettings(lpss, SSF_HIDEICONS, False);
finally
Button1.Caption := IfThen(lpss.fHideIcons, 'Show Icons', 'Hide Icons');
end;
EnumWindows(@GetHandle, 0);
Button1.Enabled := (hDesktop <> 0);
end;
procedure TMainFrm.Button1Click(Sender: TObject);
const
nCmdShow: array [Boolean] of NativeInt = (SW_HIDE, SW_SHOW);
var
lpss: TShellState;
begin
ZeroMemory(@lpss, SizeOf(lpss));
try
SHGetSetSettings(lpss, SSF_HIDEICONS, False);
ShowWindow(hDesktop, nCmdShow[lpss.fHideIcons]);
lpss.fHideIcons := (not BOOL(lpss.fHideIcons));
Button1.Caption := IfThen(lpss.fHideIcons, 'Show Icons', 'Hide Icons');
finally
SHGetSetSettings(lpss, SSF_HIDEICONS, True);
end;
end;
end.
アプリケーションのスクリーンショット
どんな助けでも大歓迎です。
アップデート
「プロファイラーツールバー」をオフにする方法についての情報を提供してくれたTOndrejのおかげで、IDEツールバーが消えなくなり、エラーが表示されなくなりました。今、私は非常に厄介なちらつきを受け取り、通常に戻るのに10〜15秒かかることがあります。