I'm on Delphi 10.4.
I'm looking for a way to dynamically insert a number on the app's icon on the taskbar, so the user can know about how many tasks the apps has done so far. This would be dynamically, as soon as the app does a new task, it will increase the icon's number.
Something like the image below.
Is this possible ?
I don't have any code to post here because i don't have any idea how to do this.
Delphi has no control over it. Windows simply selects "the first icon" as the default application icon.
Here is the link to high resolution image of the bike that I want to use as a icon for my component. 1) Save the image as a bitmap file, but the file is huge – 40 MB and 4819×2968 pixels. That’s OK! 2) Create a new Delphi package project. To keep the steps simple let’s stick with just one “designtime and runtime” package.
The default icon to use as the application icon is determined by Windows. Delphi has no control over it. Windows simply selects "the first icon" as the default application icon.
7) Create a new visual Delphi app. In the Tool Palette you should find new “Samples” category with a new component with custom image. It seems to be a not very documented, but I hope that this approach is OK to use and that you will find it useful!
You might not be aware of the TTaskbar
taskbar-configuration component and its OverlayIcon
property.
Example:
with a very straightforward implementation:
procedure TForm1.btnInfoClick(Sender: TObject);
var
io: TIcon;
begin
io := TIcon.Create;
try
io.Handle := LoadIcon(0, IDI_INFORMATION);
Taskbar1.OverlayIcon := io
finally
io.Free;
end;
end;
In your case, you can either create icons 1.png
, 2.png
, ... non-programmatically and use those, or you can create icons programmatically (create a CreateOverlayIcon(ANumber: Integer): TIcon
function).
I should warn you, however, that the TTaskbar
component used to be (very) buggy. Therefore I would not use that one; instead, I would use the ITaskbarList3::SetOverlayIcon
API directly.
In any case, my suggestion is to split your problem into two parts:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With