I want my program (developed with Delphi 10.3) to show a different taskbar icon depending on the database it is working on.
I use this code in my OnCreate handler (the DBCompany and CompanyIconFile variables are loaded from an INI file):
procedure TFrmMain.FormCreate(Sender: TObject);
var
IcoFile: string;
begin
Application.Title := DBCompany + ' ' + Application.Title;
IcoFile := CompanyIconFile;
if FileExists(IcoFile) then
begin
Application.Icon.LoadFromFile(IcoFile);
Self.Icon.LoadFromFile(IcoFile);
end;
end;
This works as it should on Windows 7, Windows 8, Windows 10: the taskbar shows the company's icon.
On Win 11, it doesn't work. Instead, the Win 11 taskbar always shows the icon that I assigned to the application in the Delphi project options.
I restarted the Win 11 computer, so it could not be the icon cache (?).
FileExists()and.LoadFromFile()succeed?