屏幕截图
以下源代码用于产生上述错误。您所要做的就是编译程序并确保IDE仍在运行(如果IDE关闭则不会发生错误),单击按钮12到15次,将弹出错误。
发生错误后,切换回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.
应用程序屏幕截图
非常感谢任何帮助。
更新
IDE工具栏不再消失,并且错误不再出现,这要归功于TOndrej关于关闭“Profiler工具栏”的信息。现在我得到一个非常讨厌的闪烁,有时需要10到15秒才能恢复正常。
答案 0 :(得分:5)
你安装了AQTime吗?如果您只是隐藏Profiler工具栏,问题似乎就消失了。