windows - 为什么这个错误会一直扰乱 XE2 IDE 工具栏?

标签 windows delphi windows-7 ide delphi-xe2

屏幕截图

enter image description here

以下源代码用于产生上述错误。您所要做的就是编译程序并确保 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.

应用程序屏幕截图

enter image description here

如有任何帮助,我们将不胜感激。

更新

IDE 工具栏不再消失,错误也不再出现,感谢 TOndrej 提供有关关闭“Profiler 工具栏”的信息。现在我遇到了一个非常烦人的闪烁,有时需要 10 到 15 秒才能恢复正常。

最佳答案

您是否安装了 AQTime?如果您只是隐藏 Profiler 工具栏,问题似乎就会消失。

关于windows - 为什么这个错误会一直扰乱 XE2 IDE 工具栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10476327/

相关文章:

Delphi/ADO : Which components? TADODataSet 和 TADOCommand 或 TADOQuery?

windows-7 - Wiimote 的 Windows HID 设备驱动程序安装。我们可以改进它吗?

c# - 插件在 Win 7 上的应用刷新页面时崩溃

c# - 64 位操作系统和 32 位应用程序

c - 线程分配内存,主进程死亡,会发生什么?

c# - 通过 COM 接口(interface)时出错

delphi - 如何在两台计算机之间发送字符串?

c++ - 复制另一个进程正在使用的文件

windows - perl 优先于 glob @argv

c - 在 Linux 上使用 `splice`……其他系统还有什么?