Menampilkan Informasi Package pada BDS About Box
Tahun lalu, saya pernah membahas trik bagaimana Menampilkan Informasi Package pada BDS SplashScreen. Pembahasan tersebut sebetulnya belum selesai, karena ada satu hal lagi yang lupa saya sampaikan, yaitu trik bagaimana Menampilkan Informasi Package pada BDS / GodeGear About Box.
Oke, tanpa ba-bi-bu, langsung aja, bagaimana menampilkan entri seperti yang disajikan pada gambar berikut?

Intinya masih tetap sama, menggunakan OTA (Open Tools API). Kali ini method yang digunakan adalah AddPluginInfo dan AddProductInfo.
ToolsAPI Documentation:
Call AddPluginInfo to provide information specific to a particular plugin.
The caller should save the returned index in order to later remove the
plug-in info using RemovePluginInfo. Title is displayed in a listbox in
which the user can select. Description is displayed in a memo which
should describe the plugin. And the Image is displayed next to the
Description when the title is selected. The Image should follow the same
size and rules as required for a plugin image in the splash screen. See
IOTASplashScreenServices. If IsUnRegistered is true, the title will be
painted red. LicenseStatus will be shown in a label when the title is
selected. SKUName will also be shown in a label when the title is selectedAddProductInfo follows the same rules as AddPluginInfo, except for
providing the About box Dialog title, copyright string and the extra
about box graphic. ACopyright should include both the product name,
version, and copyright info. This information is displayed at the top of
the about box. The Product image has the same rules as the image
passed to AddPluginInfo. If IsUnRegistered is true, the title will be
painted red. LicenseStatus will be shown in a label when the title is
selected. SKUName will also be shown in a label when the title is selected
function AddPluginInfo(const ATitle, ADescription: string; AImage: HBITMAP;
AIsUnRegistered: Boolean = False; const ALicenseStatus: string = '';
const ASKUName: string = ''): Integer;
function AddProductInfo(const ADialogTitle, ACopyright, ATitle, ADescription: string;
AAboutImage, AProductImage: HBITMAP; AIsUnRegistered: Boolean = False;
const ALicenseStatus: string = ''; const ASKUName: string = ''): Integer;
Yang perlu diingat adalah, ketika suatu package menambahkan entri informasi pada jendela About Box, maka entri tersebut juga harus dihapus ketika package tersebut di-unload. Untuk menghapus entri, menggunakan method berikut:
{ When a plugin is unloaded, it should actively remove itself from the
AboutBoxServices but specifying the index returned from AddPluginInfo }
procedure RemovePluginInfo(Index: Integer);
{ When a product personality is unloaded, it should actively remove itself
from the AboutBoxServices but specifying the index returned from
AddProductInfo }
procedure RemoveProductInfo(Index: Integer);
Nah bentuk implementasinya seperti ini:
unit RegisterMyPackage;
interface
implementation
uses
ToolsAPI, Windows, Graphics, SysUtils;
var
AboutBoxServices : IOTAAboutBoxServices = nil;
AboutBoxIndex : Integer = 0;
resourcestring
resPackageName = 'Bayu Prasetio''s Components Collection';
resLicense = 'Internal Usage';
resAboutCopyright = 'Copyright Bayu Prasetio';
resAboutTitle = 'Bayu Prasetio''s Components Collection';
resAboutDescription = 'This package contains some components' + #13#10 +
'created and developed by Bayu Prasetio';
procedure RegisterSplashScreen;
var
bmp: TBitmap;
begin
bmp := TBitmap.Create;
bmp.LoadFromResourceName(HInstance, 'SPLASH');
SplashScreenServices.AddPluginBitmap(resPackageName, bmp.Handle, False, resLicense, '');
bmp.Free;
end;
procedure RegisterAboutBox;
var
ProductImage: HBITMAP;
begin
Supports(BorlandIDEServices,IOTAAboutBoxServices, AboutBoxServices);
ProductImage := LoadBitmap(FindResourceHInstance(HInstance), 'SPLASH');
AboutBoxIndex := AboutBoxServices.AddPluginInfo(resPackageName, 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.
Semoga bermanfaat.






