0

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 (?).

2
  • 3
    ...and what makes you sure both FileExists() and .LoadFromFile() succeed? Commented Feb 20, 2024 at 12:30
  • Well, a) I know that they are there, b) I verified by single stepping and c) I copied all files and directories directly to a Windows 10 Computer and there it works. Commented Feb 22, 2024 at 7:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.