Fix safe work

This commit is contained in:
alinvip22@gmail.com
2023-05-06 11:54:48 +05:00
parent 0c887a8980
commit 329ea5a41b
2 changed files with 25 additions and 9 deletions
+12
View File
@@ -50,17 +50,29 @@ end;
procedure TFormHelper.SetWindowColorMode(IsDark: Boolean);
begin
try
SetWindowColorModeFor(handle, IsDark);
except
//
end;
end;
procedure TFormHelper.SetWindowColorModeAsSystem;
begin
try
SetWindowColorModeAsSystemFor(Handle);
except
//
end;
end;
class function TFormHelper.SystemIsDarkMode: Boolean;
begin
try
Result := IsDarkMode;
except
Result := False;
end;
end;
{$ELSE}
+4
View File
@@ -123,6 +123,7 @@ var
LRegistry: TRegistry;
begin
Result := False;
try
LRegistry := TRegistry.Create;
try
LRegistry.RootKey := HKEY_CURRENT_USER;
@@ -131,6 +132,9 @@ begin
finally
LRegistry.Free;
end;
except
Result := False;
end;
end;
function ShouldSystemUseDarkMode: BOOL;