Changed some Windows API imports to improve compatibility with C++ Builder

This commit is contained in:
salvadordf 2021-10-27 12:18:33 +02:00
parent f9b7447094
commit e3cee7cf9b
5 changed files with 16 additions and 12 deletions

View File

@ -1114,12 +1114,13 @@ end;
procedure TMiniBrowserFrm.Useragent1Click(Sender: TObject);
var
TempUA : string;
TempOldUA, TempNewUA : string;
begin
TempUA := inputbox('MiniBrowser demo', 'Set new user agent string', '');
TempOldUA := GetDefaultCEFUserAgent;
TempNewUA := inputbox('MiniBrowser demo', 'Set new user agent string', TempOldUA);
if (length(TempUA) > 0) then
Chromium1.SetUserAgentOverride(TempUA);
if (length(TempNewUA) > 0) and (TempOldUA <> TempNewUA) then
Chromium1.SetUserAgentOverride(TempNewUA);
end;
procedure TMiniBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage);

View File

@ -2303,7 +2303,7 @@ begin
{$IFDEF MSWINDOWS}
ZeroMemory(@TempMemStatus, SizeOf(TMyMemoryStatusEx));
TempMemStatus.dwLength := SizeOf(TMyMemoryStatusEx);
if GetGlobalMemoryStatusEx(TempMemStatus) then
if GetGlobalMemoryStatusEx(@TempMemStatus) then
Result := TempMemStatus.ullTotalPhys;
{$ENDIF}
end;
@ -2318,7 +2318,7 @@ begin
{$IFDEF MSWINDOWS}
ZeroMemory(@TempMemStatus, SizeOf(TMyMemoryStatusEx));
TempMemStatus.dwLength := SizeOf(TMyMemoryStatusEx);
if GetGlobalMemoryStatusEx(TempMemStatus) then
if GetGlobalMemoryStatusEx(@TempMemStatus) then
Result := TempMemStatus.ullAvailPhys;
{$ENDIF}
end;
@ -2334,7 +2334,8 @@ begin
{$IFDEF MSWINDOWS}
ZeroMemory(@TempMemStatus, SizeOf(TMyMemoryStatusEx));
TempMemStatus.dwLength := SizeOf(TMyMemoryStatusEx);
if GetGlobalMemoryStatusEx(TempMemStatus) then Result := TempMemStatus.dwMemoryLoad;
if GetGlobalMemoryStatusEx(@TempMemStatus) then
Result := TempMemStatus.dwMemoryLoad;
{$ENDIF}
end;

View File

@ -154,10 +154,10 @@ procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : TCe
{$ENDIF}
{$IFDEF MSWINDOWS}
function ProcessUnderWow64(hProcess: THandle; var Wow64Process: BOOL): BOOL; stdcall; external Kernel32DLL name 'IsWow64Process';
function ProcessUnderWow64(hProcess: THandle; Wow64Process: PBOOL): BOOL; stdcall; external Kernel32DLL name 'IsWow64Process';
function PathIsRelativeAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeA';
function PathIsRelativeUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeW';
function GetGlobalMemoryStatusEx(var Buffer: TMyMemoryStatusEx): BOOL; stdcall; external Kernel32DLL name 'GlobalMemoryStatusEx';
function GetGlobalMemoryStatusEx(lpBuffer: LPMEMORYSTATUSEX): BOOL; stdcall; external Kernel32DLL name 'GlobalMemoryStatusEx';
function PathCanonicalizeAnsi(pszBuf: LPSTR; pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeA';
function PathCanonicalizeUnicode(pszBuf: LPWSTR; pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeW';
function PathIsUNCAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCA';
@ -1463,7 +1463,8 @@ function Is32BitProcessRunningIn64BitOS : boolean;
var
TempResult : BOOL;
begin
Result := ProcessUnderWow64(GetCurrentProcess, TempResult) and TempResult;
Result := ProcessUnderWow64(GetCurrentProcess, @TempResult) and
TempResult;
end;
{$ENDIF}
@ -2141,7 +2142,7 @@ begin
TempOS := TempOS + ' ' + inttostr(TempMajorVer) + '.' + inttostr(TempMinorVer);
if ProcessUnderWow64(GetCurrentProcess(), Temp64bit) and Temp64bit then
if ProcessUnderWow64(GetCurrentProcess(), @Temp64bit) and Temp64bit then
TempOS := TempOS + '; WOW64';
if (GlobalCEFApp <> nil) then

View File

@ -366,6 +366,7 @@ type
ullAvailVirtual : uint64;
ullAvailExtendedVirtual : uint64;
end;
LPMEMORYSTATUSEX = ^TMyMemoryStatusEx;
TOSVersionInfoEx = record
dwOSVersionInfoSize: DWORD;

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 331,
"InternalVersion" : 332,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "95.7.12.0"
}