简体   繁体   中英

Why my icon and info on Delphi Splash Screen only shows the first time?

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!

我想你可以尝试在注册过程开始时调用ForceDemandLoadState(dlDisable)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM