Thema: Delphi Load external font

Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

Load external font

  Alt 8. Jan 2023, 17:57
Delphi-Version: 11 Alexandria
Delphi-Quellcode:
function LoadResourceFont(const AFileName: string): Boolean;
begin
  Result := AddFontResourceW(PWideChar(AFileName)) <> 0;

  if Result then
    SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
  ;
end;
And a bit longer function for loading from resource.
I see that SendMessage freezes program. Without it not only not freezes app, but also font is loaded properly to controls

Initially I created functions in D7 and used it on XP-7.
Last I used it on D10.2 on 7, now after years in D11.2 also on 7, but now I see it not working as expacted (also in D7/XE2 test app).

What to do?
  Mit Zitat antworten Zitat