Thema: Delphi Load external font

Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.184 Beiträge
 
Delphi 12 Athens
 
#2

AW: Load external font

  Alt 8. Jan 2023, 20:12
HWND_BROADCAST is never sent with SendMessage, but with PostMessage.
Because otherwise there can be such problems if any application does not respond properly.
Alternatively SendNotifyMessage or SendMessageTimeout.

Why broadcast to ALL running applications in the system if you only temporarily install the font in your application?
SendMessage to Application.Handle



Zitat:
Delphi-Quellcode:
function LoadResourceFont(const AFileName: string): Boolean;
begin
  Result := AddFontResourceW(PWideChar(AFileName)) <> 0;
Delphi-Quellcode:
function LoadResourceFont(const AFileName: WideString): Boolean; // or UnicodeString
begin
  Result := AddFontResourceW(PWideChar(AFileName)) <> 0;
or
Delphi-Quellcode:
function LoadResourceFont(const AFileName: string): Boolean;
begin
  Result := AddFontResource(PChar(AFileName)) <> 0;
$2B or not $2B

Geändert von himitsu ( 8. Jan 2023 um 20:17 Uhr)
  Mit Zitat antworten Zitat