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;