Jump to content

UEZ

MVPs
  • Posts

    7,486
  • Joined

  • Last visited

  • Days Won

    95

UEZ last won the day on April 2

UEZ had the most liked content!

About UEZ

  • Birthday 12/03/2007

Profile Information

  • Member Title
    Never say never
  • Location
    Germany
  • Interests
    Computer, watching movies, football (soccer), being lazy :-)

Recent Profile Visitors

11,335 profile views

UEZ's Achievements

  1. Thank you both for testing. 👍 @AndyG my previous version is ok for x86 because I didn't use threading. With lasted update I changed it to threading, ergo encoding is executed in a separate thread but for some reason it doesn't work for x86. Actually I cannot find the issue - maybe VfW‑Thread‑Affinity‑Problem under x86.
  2. Should be fixed now - you may try it again. x64 should work - x86 may have some issues and may crash! Btw, I renamed the GraphicsCaptureWrapper DLLs and record time is now 20 seconds. You don't need Ultrafast, Superfast should be ok, too.
  3. I got same message -> need to investigate... Thx
  4. @AndyG Were there any problems with the player? @Danyfirex reported problems with VLC Player playing AVI file.
  5. Can you please test also ? Thanks.
  6. Can someone with a 2K+ monitor test whether screen recording works at 60 fps? The previous version used the GDI API to send frames to the codec, which is too slow at high screen resolutions. Windows build 18362+ required! Link to: ScreenRecorder2_vfw Please unzip the 7-Zip archive and run one of the executable files. Recording will begin on the main screen as soon as the CMD window appears and a yellow rectangle is displayed. Please run “Configure_x264vfw.cmd” (default is the x64 DLL version), adjust the settings according to this screenshot, and then click “OK”: Once the recording is complete, the “Actual Time” should be roughly equal to the “Target Time,” which is 15 seconds (900 frames). Can you please post your screen size and the “actual time”? My result: 1920x1200 Actual time : 15.01514229999849 seconds The closer the actual time is to the recorded time, the more accurate the recording was. Thanks.
  7. Can somebody please test ScreenRecorder_vfw? Before you run any of the executable files, please run “Configure_x264vfw.cmd”, adjust the settings according to this screenshot, and then click “OK”: It should record the primary monitor in full-screen mode at 30 fps for 10 seconds. The result should be saved in the file output.avi. Is it working for you? Which resolution? Is 30 fps achieved? Can be checked e.g. with MediaPlayerClassic, VLC Player, etc. THANKS!
  8. You actually specified the file size above, so the question was unnecessary. For high-resolution video recordings, you shouldn't enable in-memory decoding. The script roughly checks whether there is enough memory for the decompression in the memory. If not, playback is skipped. The lower the quality and bitrate settings are, the faster the encoding speed, but the lower the recording quality. I need to figure out how to use other codecs for full-screen video recordings. WebP isn't really suitable for that.
  9. @Werty Estimated FPS is only an indicator not real FPS because WebP uses delta frames that means only the differences will be saved. When nothing is changing no additional frames will be saved. Probably WebP codec is not designed for realtime recording, especially for large screens. Wondering why it fails at 3840 x 2160. When save fails the webp dll returns a negative value which should be displayed when recording has finished. @AndyG obviously all frames couldn't extracted to memory -> probably out of memory or WebPMalloc() cannot handle it - it needs several gigs of memory for this screen resolution. Is the recording saved? Thank you all three for testing!
  10. The C++ DLL now works perfectly, at least on my system. Could someone please test the WebP example “Example09.1.au3”, which can be found here? -> WebP.7z. Requires Windows10 build 18362+. It should work on both architectures—x86 and x64. It records for 10 seconds at 30 FPS; at least, that’s the goal. Please run the script via SciTE, select the entire primary monitor, and start recording. As soon as the yellow rectangle appears, recording begins. If possible, it would be great to see the utilization level in the GPU monitor. In theory, the recording should use the GPU. You can use Process Explorer from Sysinternals to see GPU. Once the recording is complete, a summary should appear in the SciTE console, similar to the one shown here: ... Animation file size: 56571058 bytes Dimension: 1920 x 1080 Frame count: 158 Duration: 10046 ms Estimated FPS: 15.7276527971332 CPU: Intel Core Ultra 5 135U GPU: Intel(R) Graphics Can you post your result here? Which CPU / Gfx card you have used for testing? Thanks.
  11. How about colored checkboxes? ;Coded by UEZ build 2026-04-07 ;Direct2D code by Eukalyptus / trancexx ;Proof of concept version #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> #region D2D init If @OSBuild < 9600 Then Exit MsgBox($MB_ICONERROR, "ERROR", "Windows 8.1 or higher required!", 30) Global Const $WICERR_NOOBJ = 0x800710D8 Global Const $sGUID_WICPixelFormat32bppPBGRA = "{6fddc324-4e03-4bfe-b185-3d77768dc910}" Global Const $sCLSID_WICImagingFactory = "{cacaf262-9370-4615-a13b-9f5539da4c0a}" Global Const $sIID_IWICImagingFactory = "{ec5ec8a9-c395-4314-9c77-54d7a935ff70}" Global Const $sIID_IWICBitmap = "{00000121-a8f2-4877-ba0a-fd2b6645fb94}" Global Const $tagIWICBitmapSource = "GetSize hresult(uint*;uint*);" & "GetPixelFormat hresult(struct*);" & "GetResolution hresult(double*;double*);" & "CopyPalette hresult(struct*);" & "CopyPixels hresult(struct*;uint;uint;struct*);" Global Const $tagIWICImagingFactory = "CreateDecoderFromFilename hresult(wstr;struct*;uint;uint;ptr*);" & "CreateDecoderFromStream hresult(struct*;struct*;uint;ptr*);" & "CreateDecoderFromFileHandle hresult(handle;struct*;uint;ptr*);" & "CreateComponentInfo hresult(struct*;ptr*);" & "CreateDecoder hresult(struct*;struct*;ptr*);" & "CreateEncoder hresult(struct*;struct*;ptr*);" & "CreatePalette hresult(ptr*);" & "CreateFormatConverter hresult(ptr*);" & "CreateBitmapScaler hresult(ptr*);" & "CreateBitmapClipper hresult(ptr*);" & "CreateBitmapFlipRotator hresult(ptr*);" & "CreateStream hresult(ptr*);" & "CreateColorContext hresult(ptr*);" & "CreateColorTransformer hresult(ptr*);" & "CreateBitmap hresult(uint;uint;struct*;uint;ptr*);" & "CreateBitmapFromSource hresult(struct*;uint;ptr*);" & "CreateBitmapFromSourceRect hresult(struct*;uint;uint;uint;uint;ptr*);" & "CreateBitmapFromMemory hresult(uint;uint;struct*;uint;uint;struct*;ptr*);" & "CreateBitmapFromHBITMAP hresult(handle;handle;uint;ptr*);" & "CreateBitmapFromHICON hresult(handle;ptr*);" & "CreateComponentEnumerator hresult(uint;uint;ptr*);" & "CreateFastMetadataEncoderFromDecoder hresult(struct*;ptr*);" & "CreateFastMetadataEncoderFromFrameDecode hresult(struct*;ptr*);" & "CreateQueryWriter hresult(struct*;struct*;ptr*);" & "CreateQueryWriterFromReader hresult(struct*;struct*;ptr*);" Global Const $tagIWICBitmap = $tagIWICBitmapSource & "Lock hresult(struct*;uint;ptr*);" & "SetPalette hresult(struct*);" & "SetResolution hresult(double;double);" Global Const $DWRITEERR_NOOBJ = 0x800710D8 Global Const $sIID_IDWriteFactory = "{b859ee5a-d838-4b5b-a2e8-1adc7d93db48}" Global Const $sIID_IDWriteTextFormat = "{9c906818-31d7-4fd3-a151-7c5e225db55a}" Global Const $tagIDWriteFactory = "GetSystemFontCollection hresult(ptr*;bool);" & "CreateCustomFontCollection hresult(struct*;struct*;uint;ptr*);" & "RegisterFontCollectionLoader hresult(struct*);" & "UnregisterFontCollectionLoader hresult(struct*);" & "CreateFontFileReference hresult(wstr;struct*;ptr*);" & "CreateCustomFontFileReference hresult(struct*;uint;struct*;ptr*);" & "CreateFontFace hresult(uint;uint;struct*;uint;uint;ptr*);" & "CreateRenderingParams hresult(ptr*);" & "CreateMonitorRenderingParams hresult(handle;ptr*);" & "CreateCustomRenderingParams hresult(float;float;float;uint;uint;ptr*);" & "RegisterFontFileLoader hresult(struct*);" & "UnregisterFontFileLoader hresult(struct*);" & "CreateTextFormat hresult(wstr;struct*;uint;uint;uint;float;wstr;ptr*);" & "CreateTypography hresult(ptr*);" & "GetGdiInterop hresult(ptr*);" & "CreateTextLayout hresult(wstr;uint;struct*;float;float;ptr*);" & "CreateGdiCompatibleTextLayout hresult(wstr;uint;struct*;float;float;float;struct*;bool;ptr*);" & "CreateEllipsisTrimmingSign hresult(struct*;ptr*);" & "CreateTextAnalyzer hresult(ptr*);" & "CreateNumberSubstitution hresult(uint;wstr;bool;ptr*);" & "CreateGlyphRunAnalysis hresult(struct*;float;struct*;uint;uint;float;float;ptr*);" Global Const $tagIDWriteTextFormat = "SetTextAlignment hresult(uint);" & "SetParagraphAlignment hresult(uint);" & "SetWordWrapping hresult(uint);" & "SetReadingDirection hresult(uint);" & "SetFlowDirection hresult(uint);" & "SetIncrementalTabStop hresult(float);" & "SetTrimming hresult(struct*;ptr*);" & "SetLineSpacing hresult(uint;float;float);" & "GetTextAlignment uint();" & "GetParagraphAlignment uint();" & "GetWordWrapping uint();" & "GetReadingDirection uint();" & "GetFlowDirection uint();" & "GetIncrementalTabStop float();" & "GetTrimming hresult(struct*;ptr*);" & "GetLineSpacing hresult(uint*;float*float*);" & "GetFontCollection hresult(ptr*);" & "GetFontFamilyNameLength uint(wstr;uint);" & "GetFontFamilyName hresult();" & "GetFontWeight uint();" & "GetFontStyle uint();" & "GetFontStretch uint();" & "GetFontSize float();" & "GetLocaleNameLength uint();" & "GetLocaleName hresult(wstr;uint);" Global Const $D2DERR_NOOBJ = 0x800710D8 Global Const $D2DERR_UFAIL = 0x8000FFFF Global Const $tagD2D1_MATRIX_3X2_F = "struct; float M11; float M12; float M21; float M22; float M31; float M32; endstruct;" Global Const $tagD2D1_COLOR_F = "struct; float R; float G; float B; float A; endstruct;" Global Const $tagD2D1_RECT_F = "struct; float Left; float Top; float Right; float Bottom; endstruct;" Global Const $tagD2D1_BRUSH_PROPERTIES = "struct; float Opacity; float M11; float M12; float M21; float M22; float M31; float M32; endstruct;" Global Const $tagD2D1_RENDER_TARGET_PROPERTIES = "struct; uint Type; uint PixelFormat; uint AlphaMode; float DpiX; float DpiY; uint Usage; uint MinLevel; endstruct;" Global Const $sIID_ID2D1SolidColorBrush = "{2cd906a9-12e2-11dc-9fed-001143a055f9}" Global Const $sIID_ID2D1RenderTarget = "{2cd90694-12e2-11dc-9fed-001143a055f9}" Global Const $sIID_ID2D1Factory = "{06152247-6f50-465a-9245-118bfd3b6007}" Global Const $tagID2D1Resource = "GetFactory none(ptr*);" Global Const $tagID2D1Brush = $tagID2D1Resource & "SetOpacity none(float);" & "SetTransform none(struct*);" & "GetOpacity float();" & "GetTransform none(struct*);" Global Const $tagID2D1SolidColorBrush = $tagID2D1Brush & "SetColor none(struct*);" & "GetColor ptr(struct*);" Global Const $tagID2D1RenderTarget = $tagID2D1Resource & "CreateBitmap hresult(struct;struct*;uint;struct*;ptr*);" & "CreateBitmapFromWicBitmap hresult(struct*;struct*;ptr*);" & "CreateSharedBitmap hresult(struct*;struct*;struct*;ptr*);" & "CreateBitmapBrush hresult(struct*;struct*;struct*;ptr*);" & "CreateSolidColorBrush hresult(struct*;struct*;ptr*);" & "CreateGradientStopCollection hresult(struct*;uint;uint;uint;ptr*);" & "CreateLinearGradientBrush hresult(struct*;struct*;struct*;ptr*);" & "CreateRadialGradientBrush hresult(struct*;struct*;struct*;ptr*);" & "CreateCompatibleRenderTarget hresult(struct*;struct*;struct*;uint;ptr*);" & "CreateLayer hresult(struct*;ptr*);" & "CreateMesh hresult(ptr*);" & "DrawLine none(struct;struct;struct*;float;struct*);" & "DrawRectangle none(struct*;struct*;float;struct*);" & "FillRectangle none(struct*;struct*);" & "DrawRoundedRectangle none(struct*;struct*;float;struct*);" & "FillRoundedRectangle none(struct*;struct*);" & "DrawEllipse none(struct*;struct*;float;struct*);" & "FillEllipse none(struct*;struct*);" & "DrawGeometry none(struct*;struct*;float;struct*);" & "FillGeometry none(struct*;struct*;struct*);" & "FillMesh none(struct*;struct*);" & "FillOpacityMask none(struct*;struct*;uint;struct*;struct*);" & "DrawBitmap none(struct*;struct*;float;uint;struct*);" & "DrawText none(wstr;uint;struct*;struct*;struct*;uint;uint);" & "DrawTextLayout none(struct;struct*;struct*;uint);" & "DrawGlyphRun none(struct;struct*;struct*;uint);" & "SetTransform none(struct*);" & "GetTransform none(struct*);" & "SetAntialiasMode none(uint);" & "GetAntialiasMode uint();" & "SetTextAntialiasMode none(uint);" & "GetTextAntialiasMode uint();" & "SetTextRenderingParams none(struct*);" & "GetTextRenderingParams none(ptr*);" & "SetTags none(uint64;uint64);" & "GetTags none(uint64*;uint64*);" & "PushLayer none(struct*;struct*);" & "PopLayer none();" & "Flush hresult(uint64*;uint64*);" & "SaveDrawingState none(struct*);" & "RestoreDrawingState none(struct*);" & "PushAxisAlignedClip none(struct*;uint);" & "PopAxisAlignedClip none();" & "Clear none(struct*);" & "BeginDraw none();" & "EndDraw hresult(uint64*;uint64*);" & "GetPixelFormat ptr(struct*);" & "SetDpi none(float;float);" & "GetDpi none(float*;float*);" & "GetSize ptr(struct*);" & "GetPixelSize ptr(struct*);" & "GetMaximumBitmapSize uint();" & "IsSupported bool(struct*);" Global Const $tagID2D1Factory = "ReloadSystemMetrics hresult();" & "GetDesktopDpi none(float*;float*);" & "CreateRectangleGeometry hresult(struct*;ptr*);" & "CreateRoundedRectangleGeometry hresult(struct*;ptr*);" & "CreateEllipseGeometry hresult(struct*;ptr*);" & "CreateGeometryGroup hresult(uint;struct*;uint;ptr*);" & "CreateTransformedGeometry hresult(struct*;struct*;ptr*);" & "CreatePathGeometry hresult(ptr*);" & "CreateStrokeStyle hresult(struct*;struct*;uint;ptr*);" & "CreateDrawingStateBlock hresult(struct*;struct*;ptr*);" & "CreateWicBitmapRenderTarget hresult(struct*;struct*;ptr*);" & "CreateHwndRenderTarget hresult(struct*;struct*;ptr*);" & "CreateDxgiSurfaceRenderTarget hresult(struct*;struct*;ptr*);" & "CreateDCRenderTarget hresult(struct*;ptr*);" Global Const $D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0 Global Const $D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1 Global Const $D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2 Global Const $D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3 Global Const $DWRITE_TEXT_ALIGNMENT_LEADING = 0 Global Const $DWRITE_TEXT_ALIGNMENT_TRAILING = 1 Global Const $DWRITE_TEXT_ALIGNMENT_CENTER = 2 Global Const $DWRITE_PARAGRAPH_ALIGNMENT_NEAR = 0 Global Const $DWRITE_PARAGRAPH_ALIGNMENT_FAR = 1 Global Const $DWRITE_PARAGRAPH_ALIGNMENT_CENTER = 2 Global Const $D2D1_ANTIALIAS_MODE_PER_PRIMITIVE = 0 Global Const $D2D1_ANTIALIAS_MODE_ALIASED = 1 Global Const $D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 4 Global Const $DWRITE_MEASURING_MODE_NATURAL = 0 Global Const $__g_hD2D1DLL = DllOpen("d2d1.dll") Global Const $__g_hDWriteDLL = DllOpen("dwrite.dll") Global $oD2DFactory = _D2D_Factory_Create() If Not IsObj($oD2DFactory) Then MsgBox(16, "Error", "Failed to create D2D Factory!") Exit EndIf Global $oWICFactory = _WIC_ImagingFactory_Create() If Not IsObj($oWICFactory) Then MsgBox(16, "Error", "Failed to create WIC Imaging Factory!") Exit EndIf Global $oDWriteFactory = _DWrite_Factory_Create() If Not IsObj($oDWriteFactory) Then MsgBox(16, "Error", "Failed to create DWrite Factory!") Exit EndIf #EndRegion _GDIPlus_Startup() Global $hBmpUnchecked1 = D2D1_RenderEmojiToGDIpBitmap($oD2DFactory, $oWICFactory, $oDWriteFactory, "🔲", 16) Global $hBmpChecked1 = D2D1_RenderEmojiToGDIpBitmap($oD2DFactory, $oWICFactory, $oDWriteFactory, "✅", 16) Global $hBmpUnchecked2 = D2D1_RenderEmojiToGDIpBitmap($oD2DFactory, $oWICFactory, $oDWriteFactory, "⬛", 16) Global $hBmpChecked2 = D2D1_RenderEmojiToGDIpBitmap($oD2DFactory, $oWICFactory, $oDWriteFactory, "☑️", 16) Global $hGUI = GUICreate("Custom Checkbox using colored Emojis by UEZ", 237, 143) GUISetBkColor(0x282828) Global $bState1 = False Global $Pic1 = GUICtrlCreatePic("", 8, 8, 16, 16) GUICtrlSendMsg($Pic1, 0x0172, $IMAGE_BITMAP, $hBmpUnchecked1) Global $Label1 = GUICtrlCreateLabel("Checkbox1", 28, 8, 97, 17) GUICtrlSetColor(-1, 0xF0F0F0) GUICtrlSetCursor($Pic1, 0) GUICtrlSetCursor($Label1, 0) Global $bState2 = True Global $Pic2 = GUICtrlCreatePic("", 8, 40, 16, 16) GUICtrlSendMsg($Pic2, 0x0172, $IMAGE_BITMAP, $hBmpUnchecked2) Global $Label2 = GUICtrlCreateLabel("Checkbox2", 28, 40, 97, 17) GUICtrlSetColor(-1, 0xF0F0F0) GUICtrlSetCursor($Pic2, 0) GUICtrlSetCursor($Label2, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBmpChecked1) _WinAPI_DeleteObject($hBmpUnchecked1) _WinAPI_DeleteObject($hBmpChecked2) _WinAPI_DeleteObject($hBmpUnchecked2) _GDIPlus_Shutdown() Exit Case $Pic1, $Label1 $bState1 = Not $bState1 If $bState1 Then GUICtrlSendMsg($Pic1, 0x0172, $IMAGE_BITMAP, $hBmpChecked1) Else GUICtrlSendMsg($Pic1, 0x0172, $IMAGE_BITMAP, $hBmpUnchecked1) EndIf Case $Pic2, $Label2 $bState2 = Not $bState2 If $bState2 Then GUICtrlSendMsg($Pic2, 0x0172, $IMAGE_BITMAP, $hBmpChecked2) Else GUICtrlSendMsg($Pic2, 0x0172, $IMAGE_BITMAP, $hBmpUnchecked2) EndIf EndSwitch WEnd #Region D2D functions Func D2D1_RenderEmojiToGDIpBitmap($oD2DFactory, $oWICFactory, $oDWriteFactory, $sEmoji, $iSize, $bGDI = True) Local $oWICBitmap = _WIC_ImagingFactory_CreateBitmap($oWICFactory, $iSize, $iSize, $sGUID_WICPixelFormat32bppPBGRA, 0x1) If Not IsObj($oWICBitmap) Then Return SetError(-1, 0, 0) Local $oRenderTarget = _D2D_Factory_CreateWicBitmapRenderTarget($oD2DFactory, $oWICBitmap) If Not IsObj($oRenderTarget) Then $oWICBitmap = 0 Return SetError(-2, 0, 0) EndIf Local $oTextFormat = _DWrite_Factory_CreateTextFormat($oDWriteFactory, "Arial", $iSize * 0.75) If Not IsObj($oTextFormat) Then $oRenderTarget = 0 $oWICBitmap = 0 Return SetError(-3, 0, 0) EndIf $oTextFormat.SetTextAlignment($DWRITE_TEXT_ALIGNMENT_CENTER) $oTextFormat.SetParagraphAlignment($DWRITE_PARAGRAPH_ALIGNMENT_CENTER) $oRenderTarget.SetTextAntialiasMode($D2D1_TEXT_ANTIALIAS_MODE_ALIASED) $oRenderTarget.SetAntialiasMode($D2D1_ANTIALIAS_MODE_ALIASED) $oRenderTarget.BeginDraw() _D2D_RenderTarget_Clear($oRenderTarget, 0, 0, 0, 0) Local $oBrush = _D2D_RenderTarget_CreateSolidColorBrush($oRenderTarget, 0, 0, 0, 0) $oRenderTarget.DrawText($sEmoji, StringLen($sEmoji), $oTextFormat, _D2D1_RECT_F(0, 0, $iSize, $iSize), $oBrush, $D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT, $DWRITE_MEASURING_MODE_NATURAL) $oRenderTarget.EndDraw(Null, Null) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iSize, $iSize, $GDIP_PXF32ARGB) If Not $hBitmap Then $oBrush = 0 $oTextFormat = 0 $oRenderTarget = 0 $oWICBitmap = 0 Return SetError(-4, 0, 0) EndIf Local $tBitmapData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $iSize, $iSize, $GDIP_ILMWRITE, $GDIP_PXF32ARGB) Local $pScan0 = $tBitmapData.Scan0 Local $iStride = BitAND(($iSize * 4 + 3), 0xFFFFFFFC) ;$iSize * 4 Local $tRect = DllStructCreate($tagRECT) $tRect.Left = 0 $tRect.Top = 0 $tRect.Right = $iSize $tRect.Bottom = $iSize $oWICBitmap.CopyPixels($tRect, $iStride, $iStride * $iSize, $pScan0) _GDIPlus_BitmapUnlockBits($hBitmap, $tBitmapData) $oBrush = 0 $oTextFormat = 0 $oRenderTarget = 0 $oWICBitmap = 0 If $bGDI Then Local $hGDI_Bmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) If @error Or Not $hGDI_Bmp Then _GDIPlus_ImageDispose($hBitmap) Return SetError(-4, 0, 0) EndIf _GDIPlus_ImageDispose($hBitmap) Return $hGDI_Bmp EndIf Return $hBitmap EndFunc ;==>D2D1_RenderEmojiToGDIpBitmap Func _WIC_ImagingFactory_Create() Local $oObj = ObjCreateInterface($sCLSID_WICImagingFactory, $sIID_IWICImagingFactory, $tagIWICImagingFactory) If Not IsObj($oObj) Then Return SetError(0x80080001, 0, False) Return $oObj EndFunc ;==>_WIC_ImagingFactory_Create Func _WIC_ImagingFactory_CreateBitmap(Const ByRef $oIImagingFactory, $iWidth, $iHeight, $sPixelFormat = $sGUID_WICPixelFormat32bppPBGRA, $iOption = 0x2) If Not IsObj($oIImagingFactory) Then Return SetError($WICERR_NOOBJ, 0, False) Local $tGUID = _WinAPI_GUIDFromString($sPixelFormat) If @error Or Not IsDllStruct($tGUID) Then Return SetError(0x80070057, 1, False) Local $pBitmap Local $iHResult = $oIImagingFactory.CreateBitmap($iWidth, $iHeight, $tGUID, $iOption, $pBitmap) If $iHResult Or Not $pBitmap Then Return SetError($iHResult, 2, False) Local $oBitmap = ObjCreateInterface($pBitmap, $sIID_IWICBitmap, $tagIWICBitmap) If Not IsObj($oBitmap) Then Return SetError(0x80080001, 3, False) Return $oBitmap EndFunc ;==>_WIC_ImagingFactory_CreateBitmap Func _D2D_Factory_Create() Local $tIID_ID2D1Factory = _WinAPI_GUIDFromString($sIID_ID2D1Factory) Local $aResult = DllCall($__g_hD2D1DLL, "int", "D2D1CreateFactory", "uint", 0, "struct*", $tIID_ID2D1Factory, "uint*", 0, "ptr*", 0) If @error Then Return SetError($D2DERR_UFAIL, 1, False) If $aResult[0] Or Not $aResult[4] Then Return SetError($aResult[0], 2, False) Local $oFactory = ObjCreateInterface($aResult[4], $sIID_ID2D1Factory, $tagID2D1Factory) If Not IsObj($oFactory) Then Return SetError(0x80080001, 3, False) Return $oFactory EndFunc ;==>_D2D_Factory_Create Func _D2D_Factory_CreateWicBitmapRenderTarget(Const ByRef $oIFactory, Const ByRef $oWICBitmap, $iPixelFormat = 87, $iAlphaMode = 1, $fDpiX = 0, $fDpiY = 0, $iUsage = 0x00000000) If Not IsObj($oIFactory) Then Return SetError($D2DERR_NOOBJ, 0, False) If Not IsObj($oWICBitmap) Then Return SetError($D2DERR_NOOBJ, 1, False) Local $tD2D1_RENDER_TARGET_PROPERTIES = _D2D1_RENDER_TARGET_PROPERTIES(1, $iPixelFormat, $iAlphaMode, $fDpiX, $fDpiY, $iUsage, 0) Local $pRenderTarget Local $iHResult = $oIFactory.CreateWicBitmapRenderTarget($oWICBitmap, $tD2D1_RENDER_TARGET_PROPERTIES, $pRenderTarget) If $iHResult Or Not $pRenderTarget Then Return SetError($iHResult, 2, False) Local $oRenderTarget = ObjCreateInterface($pRenderTarget, $sIID_ID2D1RenderTarget, $tagID2D1RenderTarget) If Not IsObj($oRenderTarget) Then Return SetError(0x80080001, 3, False) Return $oRenderTarget EndFunc ;==>_D2D_Factory_CreateWicBitmapRenderTarget Func _D2D_RenderTarget_CreateSolidColorBrush(Const ByRef $oIRenderTarget, $fRed = 0, $fGreen = 0, $fBlue = 0, $fAlpha = 1, $fOpacity = 1) If Not IsObj($oIRenderTarget) Then Return SetError($D2DERR_NOOBJ, 0, False) Local $pSolidColorBrush Local $iHResult = $oIRenderTarget.CreateSolidColorBrush(_D2D1_COLOR_F($fRed, $fGreen, $fBlue, $fAlpha), _D2D1_BRUSH_PROPERTIES($fOpacity), $pSolidColorBrush) If $iHResult Or Not $pSolidColorBrush Then Return SetError($iHResult, 1, False) Local $oSolidColorBrush = ObjCreateInterface($pSolidColorBrush, $sIID_ID2D1SolidColorBrush, $tagID2D1SolidColorBrush) If Not IsObj($oSolidColorBrush) Then Return SetError(0x80080001, 2, False) Return $oSolidColorBrush EndFunc ;==>_D2D_RenderTarget_CreateSolidColorBrush Func _D2D_RenderTarget_Clear(Const ByRef $oIRenderTarget, $fR = 0, $fG = 0, $fB = 0, $fA = 1) If Not IsObj($oIRenderTarget) Then Return SetError($D2DERR_NOOBJ, 0, False) $oIRenderTarget.Clear(_D2D1_COLOR_F($fR, $fG, $fB, $fA)) Return True EndFunc ;==>_D2D_RenderTarget_Clear Func _D2D1_COLOR_F($fR = 0, $fG = 0, $fB = 0, $fA = 1) Local $tStruct = DllStructCreate($tagD2D1_COLOR_F) $tStruct.R = $fR $tStruct.G = $fG $tStruct.B = $fB $tStruct.A = $fA Return $tStruct EndFunc ;==>_D2D1_COLOR_F Func _D2D1_RECT_F($fLeft = 0, $fTop = 0, $fRight = 0, $fBottom = 0) Local $tStruct = DllStructCreate($tagD2D1_RECT_F) $tStruct.Left = $fLeft $tStruct.Top = $fTop $tStruct.Right = $fRight $tStruct.Bottom = $fBottom Return $tStruct EndFunc ;==>_D2D1_RECT_F Func _D2D1_SIZEOF(Const ByRef $sTag) Local $tStruct = DllStructCreate($sTag) Return DllStructGetSize($tStruct) EndFunc ;==>_D2D1_SIZEOF Func _D2D1_BRUSH_PROPERTIES($fOpacity = 0, $tMatrix = Null) Local $tStruct = DllStructCreate($tagD2D1_BRUSH_PROPERTIES) $tStruct.Opacity = $fOpacity If IsDllStruct($tMatrix) Then DllCall("kernel32.dll", "none", "RtlMoveMemory", "struct*", DllStructGetPtr($tStruct) + 4, "struct*", $tMatrix, "ulong_ptr", _D2D1_SIZEOF($tagD2D1_MATRIX_3X2_F)) Else $tStruct.M11 = 1 $tStruct.M22 = 1 EndIf Return $tStruct EndFunc ;==>_D2D1_BRUSH_PROPERTIES Func _D2D1_RENDER_TARGET_PROPERTIES($iType = 2, $iPixelFormat = 0, $iAlphaMode = 0, $fDpiX = 0, $fDpiY = 0, $iUsage = 0x00000000, $iMinLevel = 0) Local $tStruct = DllStructCreate($tagD2D1_RENDER_TARGET_PROPERTIES) $tStruct.Type = $iType $tStruct.PixelFormat = $iPixelFormat $tStruct.AlphaMode = $iAlphaMode $tStruct.DpiX = $fDpiX $tStruct.DpiY = $fDpiY $tStruct.Usage = $iUsage $tStruct.MinLevel = $iMinLevel Return $tStruct EndFunc ;==>_D2D1_RENDER_TARGET_PROPERTIES Func _DWrite_Factory_Create() Local $tIID_IDWriteFactory = _WinAPI_GUIDFromString($sIID_IDWriteFactory) Local $aResult = DllCall($__g_hDWriteDLL, "int", "DWriteCreateFactory", "uint", 0, "struct*", $tIID_IDWriteFactory, "ptr*", 0) If @error Or $aResult[0] Then Return SetError(1, 1, False) Local $oObj = ObjCreateInterface($aResult[3], $sIID_IDWriteFactory, $tagIDWriteFactory) If Not IsObj($oObj) Then Return SetError(0x80080001, 2, False) Return $oObj EndFunc ;==>_DWrite_Factory_Create Func _DWrite_Factory_CreateTextFormat(Const ByRef $oIFactory, $sFontFamilyName = "Arial", $fFontSize = 48, $iFontWeight = 400, $iFontStyle = 0, $iFontStretch = 5, $oFontCollection = Null, $sLocaleName = "en-us") If Not IsObj($oIFactory) Then Return SetError($DWRITEERR_NOOBJ, 0, False) If $oFontCollection <> Null And Not IsObj($oFontCollection) Then Return SetError($DWRITEERR_NOOBJ, 1, False) Local $pTextFormat Local $iHResult = $oIFactory.CreateTextFormat($sFontFamilyName, $oFontCollection, $iFontWeight, $iFontStyle, $iFontStretch, $fFontSize, $sLocaleName, $pTextFormat) If $iHResult Or Not $pTextFormat Then Return SetError($iHResult, 2, False) Local $oTextFormat = ObjCreateInterface($pTextFormat, $sIID_IDWriteTextFormat, $tagIDWriteTextFormat) If Not IsObj($oTextFormat) Then Return SetError(0x80080001, 3, False) Return $oTextFormat EndFunc ;==>_DWrite_Factory_CreateTextFormat #EndRegion Had too much Ouzo? 😉
  12. It started with copy / paste and continued without the need of StringLower because string compare is not case sensitive in Autoit -> can be removed to improve performance. I would say use a hybrid approach using one shared function for controls that behave identically and dedicated functions for complex controls like the ListView, TreeView, etc. Messages like WM_MOUSEMOVE or WM_NCHITTEST fire constantly and it doesn't make sense regarding performance to have huge different Case statements for every pixel the mouse moves, Also drawing complex GDI+ functions in WM_PAINT or WM_ERASEBKGND may reduce the overall performance.
  13. Can you please replace _PaintSizeBox() function with this and test it again? Func _PaintSizeBox($hWnd, $hDC) Local $iWinStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) ; Only proceed if both horizontal and vertical scrollbars are active If Not (BitAND($iWinStyle, $WS_HSCROLL) And BitAND($iWinStyle, $WS_VSCROLL)) Then Return False ; 1. Retrieve exact Window and Client dimensions Local $tRW = _WinAPI_GetWindowRect($hWnd) Local $tRC = _WinAPI_GetClientRect($hWnd) ; 2. Map Client coordinates to Window-DC space Local $tPoint = DllStructCreate($tagPOINT) $tPoint.X = 0 $tPoint.Y = 0 _WinAPI_ClientToScreen($hWnd, $tPoint) ; Calculate border offsets Local $iOffL = $tPoint.X - $tRW.Left Local $iOffT = $tPoint.Y - $tRW.Top ; Calculate total window dimensions Local $iWinW = $tRW.Right - $tRW.Left Local $iWinH = $tRW.Bottom - $tRW.Top ; 3. Define the SizeBox Rect Local $tCorner = DllStructCreate($tagRECT) ; LEFT/TOP: Start exactly where the client area ends (scrollbar junction) $tCorner.Left = $iOffL + $tRC.Right $tCorner.Top = $iOffT + $tRC.Bottom ; RIGHT/BOTTOM: Align with the inner edge of the window border. $tCorner.Right = $iWinW - $iOffL $tCorner.Bottom = $iWinH - $iOffT ; Adjust for ListView the size of the box If _WinAPI_GetClassName($hWnd) = "SysListView32" Then $tCorner.Right += 1 $tCorner.Bottom += 1 EndIf ; 4. Paint the box using the dark theme color Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF(0xF00000)) ;;$COLOR_TITLE_DARK _WinAPI_FillRect($hDC, $tCorner, $hBrush) _WinAPI_DeleteObject($hBrush) Return True EndFunc ;==>_PaintSizeBox
  14. Please test: <code removed because test only> Since I'm at home (vacation) I cannot properly test DPI behaviour, that's why I marked the size box in red to see if the scaling works correctly when the DPI is changed. Can somebody test and report? Thanks.
  15. Good catch - let me try to fix it...
×
×
  • Create New...