mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-29 18:50:27 +02:00
win32: fixes for unicode in GetMonitorInfo()
git-svn-id: trunk@19241 -
This commit is contained in:
parent
0ef22bee57
commit
e2075dffd2
@ -20,6 +20,7 @@
|
||||
unit Win32Extra;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$I win32defines.inc}
|
||||
|
||||
{$IFDEF TRACE}
|
||||
{$ASSERTIONS ON}
|
||||
@ -953,13 +954,21 @@ begin
|
||||
lpMonitorInfo^.rcWork := rcWork;
|
||||
lpMonitorInfo^.dwFlags := MONITORINFOF_PRIMARY;
|
||||
|
||||
{$IFDEF WindowsUnicodeSupport}
|
||||
if UnicodeEnabledOS then
|
||||
begin
|
||||
if (lpMonitorInfo^.cbSize >= sizeof(TMonitorInfoExW)) then
|
||||
PMonitorInfoExW(lpMonitorInfo)^.szDevice := 'DISPLAY'
|
||||
end
|
||||
else
|
||||
{$ENDIF}
|
||||
if (lpMonitorInfo^.cbSize >= sizeof(TMonitorInfoEx)) then
|
||||
PMonitorInfoEx(lpMonitorInfo)^.szDevice := 'DISPLAY';
|
||||
|
||||
Exit(True);
|
||||
end;
|
||||
|
||||
Result := False;
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -1956,8 +1956,29 @@ begin
|
||||
end;
|
||||
|
||||
function TWin32WidgetSet.GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||
{$IFDEF WindowsUnicodeSupport}
|
||||
var
|
||||
LocalInfo: TMonitorInfoExW;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := Win32Extra.GetMonitorInfo(hMonitor, lpmi);
|
||||
{$IFDEF WindowsUnicodeSupport}
|
||||
if (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfoEx)) then
|
||||
begin
|
||||
if UnicodeEnabledOS then
|
||||
begin
|
||||
LocalInfo.cbSize := SizeOf(TMonitorInfoExW);
|
||||
Result := Win32Extra.GetMonitorInfo(hMonitor, @LocalInfo);
|
||||
lpmi^.rcMonitor := LocalInfo.rcMonitor;
|
||||
lpmi^.rcWork := LocalInfo.rcWork;
|
||||
lpmi^.dwFlags := LocalInfo.dwFlags;
|
||||
PMonitorInfoEx(lpmi)^.szDevice := UTF16ToUTF8(LocalInfo.szDevice);
|
||||
end
|
||||
else
|
||||
PMonitorInfoEx(lpmi)^.szDevice := AnsiToUtf8(PMonitorInfoEx(lpmi)^.szDevice);
|
||||
end
|
||||
else
|
||||
{$ENDIF}
|
||||
Result := Win32Extra.GetMonitorInfo(hMonitor, lpmi);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -885,6 +885,16 @@ type
|
||||
PMonitorInfoEx = ^TMonitorInfoEx;
|
||||
TMonitorInfoEx = tagMonitorInfoEx;
|
||||
|
||||
tagMonitorInfoExW = record
|
||||
cbSize: DWord;
|
||||
rcMonitor: TRect;
|
||||
rcWork: TRect;
|
||||
dwFlags: DWord;
|
||||
szDevice: array[0..CCHDEVICENAME - 1] of WideChar;
|
||||
end;
|
||||
PMonitorInfoExW = ^TMonitorInfoExW;
|
||||
TMonitorInfoExW = tagMonitorInfoExW;
|
||||
|
||||
{painting stuff}
|
||||
|
||||
PDrawItemStruct = ^TDrawItemStruct;
|
||||
|
Loading…
Reference in New Issue
Block a user