Why does this error continue to corrupt the XE2 IDE toolbars?

Screen shot

enter image description here

To get the above error, the following source code was used. All you have to do is compile the program and make sure that the IDE is still running (the error does not occur if the IDE is closed), click the button 12-15 times and an error will appear.

Once an error has occurred, go back to the IDE, all the toolbars for the IDE then disappeared. You must close the IDE and run it again so that it appears again.

Source

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.

Application screen screen

enter image description here

Any help would be greatly appreciated.

UPDATE

IDE , , TOndrej " ". , 10 15 , .

+5
1

AQTime? , , , Profiler.

+5

All Articles