为什么我在 Delphi 初始屏幕上的图标和信息只在第一次显示?
我正在开发一个组件包,想要在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您可以尝试在注册过程开始时调用
ForceDemandLoadState(dlDisable)
。I think you could try calling
ForceDemandLoadState(dlDisable)
at the start of your register procedure.