为什么我在 Delphi 初始屏幕上的图标和信息只在第一次显示?

发布于 2025-01-03 05:12:55 字数 1955 浏览 5 评论 0原文

我正在开发一个组件包,想要在Delphi XE的splash上​​显示一个图标和一些有关它的许可证信息,例如好的组件包所做的(TMS、CnPack等)。

事实上,我正在通过 OTA 来做到这一点,但奇怪的是,只有在第一次编译和安装之后,这些东西才立即出现在启动屏幕上。关闭 Delphi 并重新打开后,什么也没有显示。

这是我的代码的摘录,它执行此操作。

unit Wizards.Information;

interface

implementation

{$R *.res}

uses
  ToolsAPI, Windows, Graphics, SysUtils;

const
  ICON_SPLASH = 'SPLASHICON';
  ICON_ABOUT = 'ABOUTICON';

var
  AboutBoxServices: IOTAAboutBoxServices = nil;
  AboutBoxIndex: Integer = 0;

resourcestring
  resPackageName = 'Delphi Framework v1.0';
  resLicense = 'Mozilla Public License 1.1';
  resAboutCopyright = 'Copyright My Company Ltd.';
  resAboutTitle = 'Delphi Framework';
  resAboutDescription = 'Good description here ;)';

procedure RegisterSplashScreen;
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create;
  try
    bmp.LoadFromResourceName(HInstance, ICON_SPLASH);
    SplashScreenServices.AddPluginBitmap(resPackageName, bmp.Handle, False, resLicense);
  finally
    bmp.Free;
  end;
end;

procedure RegisterAboutBox;
var
  ProductImage: HBITMAP;
begin
  Supports(BorlandIDEServices,IOTAAboutBoxServices, AboutBoxServices);
  ProductImage := LoadBitmap(FindResourceHInstance(HInstance), ICON_ABOUT);
  AboutBoxIndex := AboutBoxServices.AddPluginInfo(resPackageName, resAboutCopyright + #13#10#13#10 + resAboutDescription, ProductImage, False, resLicense);
end;

procedure UnregisterAboutBox;
begin
  if (AboutBoxIndex <> 0) and Assigned(AboutBoxServices) then
  begin
    AboutBoxServices.RemovePluginInfo(AboutBoxIndex);
    AboutBoxIndex := 0;
    AboutBoxServices := nil;
  end;
end;

initialization
  RegisterSplashScreen;
  RegisterAboutBox;

finalization
  UnRegisterAboutBox;
end.

正如你所看到的,我正在尝试在 Delphi XE 的“关于”框中显示一些信息,然后我就起床了,但不幸的是,这些信息在启动屏幕上也遇到了同样的问题。

怎么了?

欢迎任何提示!

提前致谢

问题已得到解答,现在一切似乎都正常,但欢迎任何其他考虑,我的意思是,欢迎与使用 ForceDemandLoadState(dlDisable) 不同的任何其他答案!< /em>

I am developing a component package and want to display a icon and some license information about it on the Delphi XE's splash, such as the good component packages do (TMS, CnPack, etc.).

In fact I'm getting to do this through the OTA, but strangely, only immediately after the first compilation and installation, these things appear on the splash screen. After closing the Delphi and reopen nothing is displayed.

Here is an excerpt from my code that does this.

unit Wizards.Information;

interface

implementation

{$R *.res}

uses
  ToolsAPI, Windows, Graphics, SysUtils;

const
  ICON_SPLASH = 'SPLASHICON';
  ICON_ABOUT = 'ABOUTICON';

var
  AboutBoxServices: IOTAAboutBoxServices = nil;
  AboutBoxIndex: Integer = 0;

resourcestring
  resPackageName = 'Delphi Framework v1.0';
  resLicense = 'Mozilla Public License 1.1';
  resAboutCopyright = 'Copyright My Company Ltd.';
  resAboutTitle = 'Delphi Framework';
  resAboutDescription = 'Good description here ;)';

procedure RegisterSplashScreen;
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create;
  try
    bmp.LoadFromResourceName(HInstance, ICON_SPLASH);
    SplashScreenServices.AddPluginBitmap(resPackageName, bmp.Handle, False, resLicense);
  finally
    bmp.Free;
  end;
end;

procedure RegisterAboutBox;
var
  ProductImage: HBITMAP;
begin
  Supports(BorlandIDEServices,IOTAAboutBoxServices, AboutBoxServices);
  ProductImage := LoadBitmap(FindResourceHInstance(HInstance), ICON_ABOUT);
  AboutBoxIndex := AboutBoxServices.AddPluginInfo(resPackageName, resAboutCopyright + #13#10#13#10 + resAboutDescription, ProductImage, False, resLicense);
end;

procedure UnregisterAboutBox;
begin
  if (AboutBoxIndex <> 0) and Assigned(AboutBoxServices) then
  begin
    AboutBoxServices.RemovePluginInfo(AboutBoxIndex);
    AboutBoxIndex := 0;
    AboutBoxServices := nil;
  end;
end;

initialization
  RegisterSplashScreen;
  RegisterAboutBox;

finalization
  UnRegisterAboutBox;
end.

As you can see I'm trying to display some information in the Delphi XE's About Box also, and I'm getting up, but this information suffer the same problem happened with the splash screen unfortunately.

What's wrong?

Any hint is welcome!

Thanks in Advance

The question is answered and everything seems to be working now, but any other consideration is welcome, I mean, any other answer diferent from use of ForceDemandLoadState(dlDisable) is welcome!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守不住的情 2025-01-10 05:12:55

我认为您可以尝试在注册过程开始时调用 ForceDemandLoadState(dlDisable)

I think you could try calling ForceDemandLoadState(dlDisable) at the start of your register procedure.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文