Skip to content

Commit

Permalink
Win.Dialogs: Fix display of UNICODE strings in WinMsg func. (FPC)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdp committed Jun 16, 2022
1 parent 94fb9bc commit 770e75e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Base/JPL.Win.Dialogs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface
{$IFDEF MSWINDOWS}

{$I .\..\jp.inc}
{$IFDEF FPC}{$MODE OBJFPC}{$H+}{$ENDIF}
{$IFDEF FPC}{$mode delphi}{$H+}{$ENDIF}

uses
Windows;
Expand Down Expand Up @@ -36,7 +36,12 @@ implementation

function WinMsg(const Text, Caption: string; Handle: HWND = 0; MBType: DWORD = MB_OK or MB_ICONINFORMATION): integer;
begin
{$IFDEF FPC}
// NOTE: Dlaczego w FPC bez takich kombinacji (PWideChar + UnicodeString) pojawiają się tutaj "krzaki"?
Result := MessageBoxW(Handle, PWideChar(UnicodeString(Text)), PWideChar(UnicodeString(Caption)), MBType);
{$ELSE}
Result := MessageBox(Handle, PChar(Text), PChar(Caption), MBType);
{$ENDIF}
end;

procedure MB(const Text: string; Caption: string = 'Information'; Handle: HWND = 0);
Expand Down

0 comments on commit 770e75e

Please sign in to comment.