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); procedure TMiniBrowserFrm.Useragent1Click(Sender: TObject);
var var
TempUA : string; TempOldUA, TempNewUA : string;
begin 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 if (length(TempNewUA) > 0) and (TempOldUA <> TempNewUA) then
Chromium1.SetUserAgentOverride(TempUA); Chromium1.SetUserAgentOverride(TempNewUA);
end; end;
procedure TMiniBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage); procedure TMiniBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage);

View File

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

View File

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

View File

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

View File

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