Forum Replies Created
-
AuthorPosts
-
This is actually an issue with all dark skins. I had the same issue with virtual tree control and I fixed it for dark skins by calling:
Winapi.UxTheme.SetWindowTheme(Handle, PWideChar(‘DarkMode_Explorer’), nil);
Handle is the control handle. For light skins the theme is ‘explorer’.
Note! This works only since Windows 10 build 17763. You need to check it.
if DefaultManager.Active and CheckWin32Version(10) and (TOSVersion.Build >= 17763) then begin if ColorIsDark(DefaultManager.GetActiveEditColor) then AVirtualTree.WindowTheme := 'DarkMode_Explorer' else AVirtualTree.WindowTheme := 'explorer'; end;-
This reply was modified 2 years, 4 months ago by
Lasse.
Setting it to false is only a temporary solution. It just shows that there are bugs in the code. For example there are pointers casted to Integer when those must be casted to NativeInt. I have fixed a lot of those but not all. I also have to still keep that setting false…
Building > Delphi Compiler > Linking > Support address space layout randomization (ASLR)
Sounds like an ASLR (Address Space Layout Randomization) issue. Have you tried to set if False in linker options?
July 28, 2023 at 6:03 am in reply to: TsSkinProvider.PaintAll -> GDIError (EOutOfResources = out of memory) #71302Yes, FreeAndNil(FTextTimer) is ok.
TTimer destroy will disable it.
destructor TTimer.Destroy; begin FEnabled := False; ...July 28, 2023 at 6:01 am in reply to: TsSkinProvider.PaintAll -> GDIError (EOutOfResources = out of memory) #71301You can check what objects can be created for SelectObject.
– Bitmap: CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap, CreateDIBitmap, CreateDIBSection
– Brush: CreateBrushIndirect, CreateDIBPatternBrush, CreateDIBPatternBrushPt, CreateHatchBrush, CreatePatternBrush, CreateSolidBrush
– Font: CreateFont, CreateFontIndirect
– Pen: CreatePen, CreatePenIndirect
– Region: CombineRgn, CreateEllipticRgn, CreateEllipticRgnIndirect, CreatePolygonRgn, CreateRectRgn, CreateRectRgnIndirectI have mostly seen CreatePen and CreateBrush leaks. But there are also many other kind of traps to fall into. The worst I know is SHGetFileInfo where you need to destroy the icon handle, if you are not using it. Usually you’re only interested in icon index.
For example
function GetIconIndex(const AFilename: string; const AFileAttributes: Cardinal; const AMoreFlags: Cardinal): Integer; var LFileInfo: TSHFileInfo; begin if SHGetFileInfo(PChar(AFilename), AFileAttributes, LFileInfo, SizeOf(TSHFileInfo), SHGFI_SYSICONINDEX or SHGFI_SMALLICON or SHGFI_ICON or AMoreFlags) = 0 then Result := -1 else begin Result := LFileInfo.iIcon; { Important! Destroy the icon, we are only using the index. } DestroyIcon(LFileInfo.hIcon); end; end;If you have source codes (sSpinEdit.pas), you can fix this like:
procedure TsBaseSpinEdit.WndProc(var Message: TMessage); ... CM_MOUSELEAVE: begin // ==> Fix starts if Assigned(FRepeatTimer) then FreeAndNil(FRepeatTimer); MousePressed := False; // <== Fix ends if Btn1State > 0 then Btn1State := 0;If you don’t have source code, you need to inherit TsSpinEdit and override WndProc.
-
This reply was modified 2 years, 7 months ago by
Lasse.
I can confirm this issue is happening with the latest version. I will try to fix it.
Have you tried to recreate your project file? If it works, you can compare what is causing the issue.
July 27, 2023 at 8:24 am in reply to: TsSkinProvider.PaintAll -> GDIError (EOutOfResources = out of memory) #71293That said… for example find “CreatePen” from AlphaSkins source and you will find a leak in sGraphUtils.pas:
SelectObject(DC, CreatePen(PS_SOLID, 2, clWhite));That will create a pen and it is never deleted. The code should be like:
var LPen: HPEN; begin LPen := CreatePen(...); try // Use the pen for drawing finally DeleteObject(LPen); // Release the GDI pen object end; end;-
This reply was modified 2 years, 7 months ago by
Lasse.
July 27, 2023 at 8:15 am in reply to: TsSkinProvider.PaintAll -> GDIError (EOutOfResources = out of memory) #71292I recommend asking ChatGPT e.g. “How to track GDIError (EOutOfResources = out of memory) errors in Delphi?”. It gives an excellent answer.
I bet my money on creating GDI objects and not deleting them somewhere. I have seen that thousand times.
Set SkinData.CustomFont = True and set Font.Color.
Use TsPageControl or add TPageControl to skin manager’s ThirdParty property.
Delphi 7 was released 2002 and used to be my favorite version for a very long time. But try to develop components for modern Delphi and you will understand why it is a huge burden to support old versions. Personally I wouldn’t support anything before Delphi XE2. Unit scopes are a must.
I played with that TsSkinManager.CommonSections a bit and it solves the problem. Thanks a lot.
March 20, 2023 at 8:19 am in reply to: Empty warning window while launching 64bit .exe Delphi 11.3 #71163Add a break point to message dialog execution.
March 17, 2023 at 12:19 pm in reply to: Empty warning window while launching 64bit .exe Delphi 11.3 #71161Have you debugged where that is coming from? I have not come across this and I have the same versions of Delphi and AlphaControls in use.
March 16, 2023 at 6:44 pm in reply to: Is anyone able to use AlphaControls with Delphi 11.2 or later? in 64-bit #71160Yes, everything works perfect now.
Good to know you’re ok.
It requires auto-renew to be turned on in your renewal and billing settings. But yes, not all service providers may have such an option.
-
This reply was modified 2 years, 4 months ago by
-
AuthorPosts