Sign in to follow this  
Followers 0
Chimp

how to see what lies behind a window? (magnifier problem)

11 posts in this topic

#1 ·  Posted (edited)

I'm again on a script that simulates a lens on the screen, >here my previous effort that works quite well but only in one mode, that is: it magnifies the area around the mouse while you move it and it shows the zoomed area into the "lens" window that stays somewhere on the screen.

In the new mode that I would like to achieve, should be magnifyed the area that lies behind the "lens" window and when you move that window it should magnify what's behind it.
Unfortunately here arises the problem, the magnifier magnifies itself recursively, (because it capture the surface of the "lens" itself and not what's behind) with the unwanted result of a zoom area that seems empty.

To see the unwanted effect, just change the value of the variable $bFollowMouse from True to False anf then move the "magnifier" window around.

(the problem is that the function _ScreenCapture_Capture() should be able to capture behind a window)

(I wish the function _ScreenCapture_Capture() where able to capture behind a window)

My question is:
Is there a way to read the content that lies behind the "lens" window? (hopefully avoiding ways like turn off the "lens" windows, make the SnapShot of what's behind, and turn on the "lens" window again, that should result in an ugly flickering effect)

any advise is welcome,
thanks

Here the listing:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Global Const $iWidth = 400, $iHeight = 200 ; lens (window) dimensions
Global $iMagnify = 5 ; zoom factor
Global $bCaptureCursor = False ; If True the cursor will be captured with the image
Global $bFollowMouse = True ; If true,  magnifies at mouse position by following it
;                             If false, magnifies portion of screen behind lens (behind the window)
;
Global $g_hGUI, $g_hGfxCtxt, $g_hBitmap, $g_hGraphics
Global $aLensDim[2], $aViewFinder[2], $CaptureX = $iWidth / ($iMagnify * 2), $CaptureY = $iHeight / ($iMagnify * 2)

Example()

Func Example()
    AutoItSetOption("GUIOnEventMode", 1)
    _GDIPlus_Startup() ;initialize GDI+
    $g_hGUI = GUICreate("Magnifier", $iWidth, $iHeight, -1, -1, -1, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
    $aLensDim = WinGetClientSize($g_hGUI)
    $idPic = GUICtrlCreatePic("", 0, 0, $aLensDim[0], $aLensDim[1], -1, $GUI_WS_EX_PARENTDRAG) ; jast as background to allow drag by client area
    GUISetState(@SW_SHOW)

    ;create buffered graphics frame set for smoother gfx object movements
    $g_hGraphics = _GDIPlus_GraphicsCreateFromHWND($g_hGUI) ;create a graphics object from a window handle
    $g_hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $g_hGraphics)
    $g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($g_hBitmap)

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    Local $g_hBitmap2 = 0
    Do
        $g_hBitmap2 = SnapShot()
        _GDIPlus_GraphicsClear($g_hGfxCtxt, 0xFF000000) ;clear bitmap for repaint
        _GDIPlus_GraphicsDrawImage($g_hGfxCtxt, $g_hBitmap2, 0, 0) ;draw bitmap to backbuffer
        _GDIPlus_GraphicsDrawImageRect($g_hGraphics, $g_hBitmap, 0, 0, $iWidth, $iHeight) ;copy drawn bitmap to graphics handle (GUI)
        _GDIPlus_BitmapDispose($g_hBitmap2)

    Until Not Sleep(10) ;sleep 10 ms to avoid high cpu usage
EndFunc   ;==>Example

Func SnapShot()
    If $bFollowMouse Then ; take snapshot around the mouse
        $aViewFinder = MouseGetPos()
    Else ; take the snapshot behind the "lens"  <-------------- this will capture the surface of the lens not what's behind <-----------------
        $aViewFinder = _WinAPI_GetClientScreenPos($g_hGUI)
        $aViewFinder[0] = $aViewFinder[0] + ($aLensDim[0] / 2)
        $aViewFinder[1] = $aViewFinder[1] + ($aLensDim[1] / 2)
    EndIf

    ; Capture region (at mouse position or behind the lens)
    $hHBITMAP = _ScreenCapture_Capture("", $aViewFinder[0] - $CaptureX, $aViewFinder[1] - $CaptureY, $aViewFinder[0] + $CaptureX, $aViewFinder[1] + $CaptureY, $bCaptureCursor)

    ; http://www.autoitscript.com/forum/topic/130856-enlargezoom-image-after-screencapture/?p=910694
    ; Create a Bitmap object from the bitmap handle
    $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hHBITMAP)

    ; Dispose of the original capture since we now have a bitmap image we can use with GDIPlus.
    _WinAPI_DeleteObject($hHBITMAP)

    ; Get the graphics context of the bitmap image.
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)

    ; Creates a new Bitmap object based on the Graphic object with a new width and height.
    $hHBITMAP = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)

    ; Dispose of the Graphic context now we have a newly sized bitmap image as a canvas.
    _GDIPlus_GraphicsDispose($hGraphic)

    ; Get the graphics context of the newly sized bitmap image
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hHBITMAP)

    ; Draw the original image onto the newly sized image.
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iWidth, $iHeight) ; 200, 200)

    ; Dispose of the Graphic context now we have drawn the original image to it.
    _GDIPlus_GraphicsDispose($hGraphic)

    ; Dispose of the original image.
    _GDIPlus_ImageDispose($hImage)

    Return ($hHBITMAP)
EndFunc   ;==>SnapShot

Func _Exit()
    ;cleanup GDI+ resources
    _GDIPlus_GraphicsDispose($g_hGfxCtxt)
    _GDIPlus_GraphicsDispose($g_hGraphics)
    _GDIPlus_BitmapDispose($g_hBitmap)
    _GDIPlus_Shutdown()
    GUIDelete($g_hGUI)
    Exit
EndFunc   ;==>_Exit

; #FUNCTION# ====================================================================================================================
; http://www.autoitscript.com/forum/topic/107966-window-space-position-size/?p=761415
; Name...........: _WinAPI_GetClientScreenPos
; Description ...: Returns the onscreen x y of a client area of a window.
; Syntax.........: _WinAPI_GetClientScreenPos($hWindow)
; Parameters ....: $hWindow     - Identifies an open handle to a window
; Return values .: Success       - Array
;                   [0] x
;                   [2] y
;                  Failure       - False
; Author ........: Nemcija
; Remarks .......: For minimized windows values wouldn't be correct!
; Related .......: _WinAPI_GetClientRect
; ===============================================================================================================================
Func _WinAPI_GetClientScreenPos($hWindow)
    Local $tLocalClientRect, $tPoint, $aiReturnValue[2]
    $tLocalClientRect = _WinAPI_GetClientRect($hWindow)
    If @error Then Return SetError(@error, @extended, False)
    $tPoint = DllStructCreate("int X;int Y")
    DllStructSetData($tPoint, "X", DllStructGetData($tLocalClientRect, "Left"))
    DllStructSetData($tPoint, "Y", DllStructGetData($tLocalClientRect, "Top"))
    _WinAPI_ClientToScreen($hWindow, $tPoint)
    If @error Then Return SetError(@error, @extended, False)
    $aiReturnValue[0] = DllStructGetData($tPoint, "X")
    $aiReturnValue[1] = DllStructGetData($tPoint, "Y")
    Return $aiReturnValue
EndFunc   ;==>_WinAPI_GetClientScreenPos
Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites



Why not use standard MS magnify.exe?

In Aero design mode press Cntl+Alt+L for lens mode and Ctrl+Alt+D for dock mode.


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

Is that documented somewhere?

no, that is not a statement, it's what I wish it where

sorry for my  grammar....

 

Why not use standard MS magnify.exe?

In Aero design mode press Cntl+Alt+L for lens mode and Ctrl+Alt+D for dock mode.

did not even know of its existence (nice)

anyway I would like to have my own self made magnifier (both for educational purposes that for use in custom contexts)


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Might be worth taking a look at >magnifier functions.

I agree

thanks for that link

I will have look....


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

I solved the problem by moving off the mag. screen to the opposite corner when the mouse nears to the window.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I solved the problem by moving off the mag. screen to the opposite corner when the mouse nears to the window.

 

thanks UEZ,

I think you are referring to solve the problem that arises when the mouse overlays the magnifier window. Thanks for the advise, but this is not what I'm trying to solve.

the problem that I'm referring here arises when the function is used in mode "zoom what's behind the magnifier window" (not easy for me to explains exactly).

In short:

Mode 1) : If you run the script as is, it runs in a way that magnifies the area around the mouse and the zoomed area is displayed in the magnifi window.

Wherever is mooved the mouse, what's around the mouse is shown zoomed in the magnifi window. (this is ok for now)

Mode 2) : To activate this mode, change the value of the variable $bFollowMouse from True to False prior of the running of the script.

This mode should zoom the area that is directly behind the magnifi window (and not the area that is around the mouse as in previous mode) so that if you want zoom a zone, you have to move the magnifi windows directly over that zone (in the same way you do when you use a real glass magnifier). The zoomed zone should be shown within the magnifi window while this window is moved around)

Unfortunately this mode do not work, for the reason I've try to explain in first post.

I'm afraid that mode 2 it's not an easy task to achieve (at least for me)

Thanks


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Ok, I think I understood. 

To get the effect work you have to disable aero.

I implemented the aero effect for WinXP by using the effect to get the screen behind a window. Have a look here: '?do=embed' frameborder='0' data-embedContent>>

 

I hope it helps you.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

There was something I wanted to look at in that code, but it never worked as it is for me on Win 7, so made the changes.

AutoIt 3.3.12.0

#include <gdiplus.au3>
#include <guiconstantsex.au3>
#include <windowsconstants.au3>

Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)

Global Const $hDwmApiDll = DllOpen("dwmapi.dll")
Global $sChkAero = DllStructCreate("int;")
DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero))
Global $aero = DllStructGetData($sChkAero, 1)
If $aero Then DllCall($hDwmApiDll, "int", "DwmEnableComposition", "uint", False)
Global $dy
If @OSBuild < 6000 Then
    Global $aTheme = _WinAPI_GetCurrentThemeName()
    If Not @error Then
        $dy = -54
    Else
        $dy = -40
    EndIf
Else
        $dy = -47
EndIf

_GDIPlus_Startup()

Global Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]")
Global Const $aFullScreen = WinGetPos($hFullScreen)

Global Const $fW = 4
Global Const $fH = 32
Global Const $iW = 640
Global Const $iH = 400
Global Const $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_OVERLAPPEDWINDOW + $WS_EX_TOPMOST)
Global Const $idTitle = GUICtrlCreateLabel("Pseudo Aero Effect by UEZ", $fW + 16, $fh / 3, 150, 16)
GUICtrlSetFont(-1, 9, 800, 0, "Arial", 4)
GUICtrlSetBkColor(-1, -2)

Global Const $idLabel = GUICtrlCreateLabel(@LF & @LF & @LF & @TAB & "Done by UEZ 2011", $fW, $fH, $iW - 2 * $fW - 2, $iH - $fH - $fW)
GUICtrlSetFont(-1, 30, 400, 0, "Arial", 4)
GUICtrlSetBkColor(-1, -2)
Global Const $idLabel_Min = GUICtrlCreateLabel("[_]", $iW - 50, $fH / 3, $fh / 2, $fh / 2)
GUICtrlSetBkColor(-1, -2)
Global Const $idLabel_Close = GUICtrlCreateLabel("[X]", $iW - 30, $fH / 3, $fh / 2, $fh / 2)
GUICtrlSetBkColor(-1, -2)

WinSetTrans($hGUI, "", 0xFF)

Global Const $hGUI_Hidden = GUICreate("", $iW, $iH, 0, 0, Default, $WS_EX_MDICHILD + $WS_EX_LAYERED, $hGUI)
GUISetState(@SW_HIDE, $hGUI_Hidden)
GUISetState(@SW_SHOW, $hGUI)
_SetGuiRoundCorners($hGUI, 16, True, False, True, False)


Global $hDev = _WinAPI_GetDC($hGUI)
Global $hDC_Area = _WinAPI_CreateCompatibleDC($hDev)
Global $hBitmap_Area = _WinAPI_CreateCompatibleBitmap($hDev, $aFullScreen[2], $aFullScreen[3])


Global Const $hDC_Zoom = _WinAPI_GetDC(0)
Global Const $hGUI_ZoomDC = _WinAPI_GetDC($hGUI_Hidden)

Global Const $memDC = _WinAPI_CreateCompatibleDC($hGUI_ZoomDC)
Global Const $memBmp = _WinAPI_CreateCompatibleBitmap($hGUI_ZoomDC, $iW, $iH)
_WinAPI_SelectObject($memDC, $memBmp)

Global $aPos = WinGetPos($hGUI)
_WinAPI_StretchBlt($hGUI_ZoomDC, 0, 0, $iW, $iH, $hDC_Zoom, $aPos[0], $aPos[1], $iW, $iH, $SRCCOPY)

_WinAPI_BitBlt($memDC, 0, 0, $iW, $iH, $hGUI_ZoomDC, 0, $dy, 0x00CC0020)

Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global Const $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)

;Global Const $GW_CHILD = 5
;Global Const $GW_HWNDNEXT = 2
Global $hRegion = _GDIPlus_RegionCreateFromRect(0, 0, $iW, $iH)
Global $hChild = _WinAPI_GetWindow($hGUI, $GW_CHILD)
Global $aRect, $msg

Do
    $aRect = ControlGetPos($hChild, "", 0)
    _GDIPlus_RegionCombineRect($hRegion, $aRect[0], $aRect[1], $aRect[2], $aRect[3], 3)
    $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT)
Until Not $hChild
_GDIPlus_GraphicsSetClipRegion($hGraphic, $hRegion)
_GDIPlus_RegionDispose($hRegion)

Global $tRectF = _GDIPlus_RectFCreate(0, 0, $iW / 1.5, $iH / 1.5)
Global $hBrush = _GDIPlus_LineBrushCreateFromRectWithAngle($tRectF, 0x80201010, 0xA0F0F0F0, -60, False, 1)

Global $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($memBmp)
Global $hBmp_Blur = _Blur($hBmp, $iW, $iH)
_GDIPlus_GraphicsDrawImage($hContext, $hBmp_Blur, 0, 0)

_GDIPlus_GraphicsFillRect($hContext, 0, 0, $iW, $iH, $hBrush)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_BitmapDispose($hBmp_Blur)

GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")

Global $exit = False

GUISetOnEvent($GUI_EVENT_RESTORE, "Restored", $hGUI)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hGUI)
GUICtrlSetOnEvent($idLabel_Close, "_Exit")
GUICtrlSetOnEvent($idLabel_Min, "_MinWin")

While Sleep(30)
;~  Repaint()
    If $exit Then ExitLoop
WEnd

GUIRegisterMsg($WM_WINDOWPOSCHANGED, "")
_WinAPI_DeleteDC($memDC)
_WinAPI_DeleteObject($memBmp)
_WinAPI_DeleteObject($hBitmap_Area)
_WinAPI_ReleaseDC($hGUI, $hDev)
_WinAPI_ReleaseDC($hGUI, $hGUI_ZoomDC)
_WinAPI_ReleaseDC(0, $hDC_Zoom)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete()
$tRectF = 0
If $aero Then DllCall($hDwmApiDll, "int", "DwmEnableComposition", "uint", True)
Exit

Func _Exit()
    $exit = True
EndFunc

Func _MinWin()
    GUISetState(@SW_MINIMIZE, $hGUI)
EndFunc

Func Restored()
    Repaint()
EndFunc

Func WM_WINDOWPOSCHANGED($hWnd, $iMsg, $StartWIndowPosaram, $lParam)
    Repaint()
    Return "GUI_RUNDEFMSG"
EndFunc

Func Repaint()
    $aPos = WinGetPos($hGUI)
    _WinAPI_StretchBlt($hGUI_ZoomDC, 0, 0, $iW, $iH, $hDC_Zoom, $aPos[0]+16, $aPos[1] + 3, $iW, $iH, $SRCCOPY)
    _WinAPI_BitBlt($memDC, 0, 0, $iW, $iH, $hGUI_ZoomDC, 0, $dy, 0x00CC0020)
    DllStructSetData($tRectF, "X", $aPos[0])
    DllStructSetData($tRectF, "Y", $aPos[1])
    $hBrush = _GDIPlus_LineBrushCreateFromRectWithAngle($tRectF, 0x80302020, 0xA0F0F0F0, -60, False, 1)
    $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($memBmp)
    $hBmp_Blur = _Blur($hBmp, $iW, $iH)
    _GDIPlus_GraphicsDrawImage($hContext, $hBmp_Blur, 0, 0)
    _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iW, $iH, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH)
    _GDIPlus_BitmapDispose($hBmp)
    _GDIPlus_BitmapDispose($hBmp_Blur)
    _GDIPlus_BrushDispose($hBrush)
EndFunc

Func WM_NCHITTEST($hWndGUI, $MsgID, $WParam, $LParam)
    If ($hWndGUI = $hGui) And ($MsgID = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST

Func _Blur($hBitmap, $iW, $iH, $fScale = 0.30, $qual = 6); by eukalyptus
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
    Local $hBmpSmall = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
    Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall)
    DllCall($__g_hGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGfxSmall, "int", 2)
    Local $hBmpBig = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
    Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig)
    DllCall($__g_hGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGfxBig, "int", 2)
    _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale)
    _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual)

    _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale)
    _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual)

    _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, 0, $iW, $iH)
    _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, 0, $iW, $iH)

    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBmpSmall)
    _GDIPlus_GraphicsDispose($hGfxSmall)
    _GDIPlus_GraphicsDispose($hGfxBig)
    Return $hBmpBig
EndFunc   ;==>_Blur

#cs
Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop)
    Local $Ret = DllCall("gdi32.dll", "int", "StretchBlt", "hwnd", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidthDest, "int", $iHeightDest, "hwnd", $hSrcDC, "int", $iXSrc, "int", $iYSrc, "int", $iWidthSrc, "int", $iHeightSrc, "dword", $iRop)
    If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0)
    Return 1
EndFunc   ;==>_WinAPI_StretchBlt
#ce
; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_GetCurrentThemeName
; Description....: Retrieves the name of the current visual styles, color scheme name, and size name.
; Syntax.........: _WinAPI_GetCurrentThemeName ( )
; Parameters.....: None
; Return values..: Success - The array that contains the following information:
;
;                           [0] - The theme path and file name.
;                           [1] - The color scheme name.
;                           [2] - The size name.
;
;                 Failure - 0 and sets the @error flag to non-zero, @extended flag may contain the system error code.
; Author.........: Yashied
; Modified.......:
; Remarks........: None
; Related........:
; Link...........: @@MsdnLink@@ GetCurrentThemeName
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_GetCurrentThemeName()
    Local $Ret = DllCall('uxtheme.dll', 'uint', 'GetCurrentThemeName', 'wstr', '', 'int', 4096, 'wstr', '', 'int', 2048, 'wstr', '', 'int', 2048)
    If @error Then
        Return SetError(1, 0, 0)
    Else
        If $Ret[0] Then
            Return SetError(1, $Ret[0], 0)
        EndIf
    EndIf
    Local $Result[3]
    For $i = 0 To 2
        $Result[$i] = $Ret[$i * 2 + 1]
    Next
    Return $Result
EndFunc   ;==>_WinAPI_GetCurrentThemeName

Func _SetGuiRoundCorners($hGUI, $iEllipse, $iLeftUp = True, $iLeftDown = True, $iRightUp = True, $iRightDown = True)
    Local $hCornerRgn
    Local $aGuiSize = WinGetPos($hGUI)
    Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $aGuiSize[2], $aGuiSize[3], $iEllipse, $iEllipse)
    If $iLeftUp = False Then
        $hCornerRgn = _WinAPI_CreateRectRgn(0, 0, $aGuiSize[2] / 2, $aGuiSize[3] / 2)
        _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR)
        _WinAPI_DeleteObject($hCornerRgn)
    EndIf
    If $iLeftDown = False Then
        $hCornerRgn = _WinAPI_CreateRectRgn(0, $aGuiSize[3] / 2, $aGuiSize[2] / 2, $aGuiSize[3])
        _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR)
        _WinAPI_DeleteObject($hCornerRgn)
    EndIf
    If $iRightUp = False Then
        $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, 0, $aGuiSize[2], $aGuiSize[3] / 2)
        _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR)
        _WinAPI_DeleteObject($hCornerRgn)
    EndIf
    If $iRightDown = False Then
        $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, $aGuiSize[3] / 2, $aGuiSize[2] - 1, $aGuiSize[3] - 1)
        _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR)
        _WinAPI_DeleteObject($hCornerRgn)
    EndIf
    _WinAPI_SetWindowRgn($hGUI, $hRgn)
EndFunc   ;==>_SetGuiRoundCorners

#region additional GDI+ functions
#cs
Func _GDIPlus_GraphicsScaleTransform($hGraphics, $nScaleX, $nScaleY, $iOrder = 0)
    Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipScaleWorldTransform", "hwnd", $hGraphics, "float", $nScaleX, "float", $nScaleY, "int", $iOrder)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_GraphicsScaleTransform

Func _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode)
    Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGraphics, "int", $iInterpolationMode)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_GraphicsSetInterpolationMode

Func _GDIPlus_LineBrushCreateFromRectWithAngle($tRectF, $iARGBClr1, $iARGBClr2, $nAngle, $fIsAngleScalable = True, $iWrapMode = 0)
    Local $pRectF, $aResult
    $pRectF = DllStructGetPtr($tRectF)
    $aResult = DllCall($__g_hGDIPDll, "uint", "GdipCreateLineBrushFromRectWithAngle", "ptr", $pRectF, "uint", $iARGBClr1, "uint", $iARGBClr2, "float", $nAngle, "int", $fIsAngleScalable, "int", $iWrapMode, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[7]
EndFunc   ;==>_GDIPlus_LineBrushCreateFromRectWithAngle

Func _GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion, $iCombineMode = 0)
    Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipSetClipRegion", "hwnd", $hGraphics, "hwnd", $hRegion, "int", $iCombineMode)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
EndFunc

Func _GDIPlus_RegionCreateFromRect($tRectF)
    Local $pRectF, $aResult
    $pRectF = DllStructGetPtr($tRectF)
    $aResult = DllCall($__g_hGDIPDll, "uint", "GdipCreateRegionRect", "ptr", $pRectF, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[2]
EndFunc

Func _GDIPlus_RegionCombineRect($hRegion, $tRectF, $iCombineMode = 2)
    Local $pRectF, $aResult
    $pRectF = DllStructGetPtr($tRectF)
    $aResult = DllCall($__g_hGDIPDll, "uint", "GdipCombineRegionRect", "hwnd", $hRegion, "ptr", $pRectF, "int", $iCombineMode)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
EndFunc

Func _GDIPlus_RegionDispose($hRegion)
    Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipDeleteRegion", "hwnd", $hRegion)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
EndFunc
#ce
#endregion
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

The Pseudo Aero Effect will not work on Win8+ regardless whether the official non existing aero is disabled.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • loganizzi
      By loganizzi
      If you look at the help file for the above command, you'll see that it states that it only works for certain zoom values (100 and 200 to 6400).   I assume that this is due to an issue in an MSDN library that the command relies on.
      After doing some investigating, I noticed that the GUIRichEdit.au3 library file contains the following code:
      ; #FUNCTION# ==================================================================================================================== ; Authors........: Chris Haslam (c.haslam) ; Modified ......: ; =============================================================================================================================== Func _GUICtrlRichEdit_SetZoom($hWnd, $iPercent) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(101, 0, False) If Not __GCR_IsNumeric($iPercent, ">0") Then Return SetError(1021, 0, False) Local $iNumerator, $iDenominator Select Case Not ($iPercent = 100 Or ($iPercent >= 200 And $iPercent < 6400)) Return SetError(1022, 0, False) Case $iPercent >= 100 $iNumerator = 10000 $iDenominator = 10000 / ($iPercent / 100) Case Else $iNumerator = 10000 * ($iPercent / 100) $iDenominator = 10000 EndSelect Return _SendMessage($hWnd, $EM_SETZOOM, $iNumerator, $iDenominator) <> 0 EndFunc ;==>_GUICtrlRichEdit_SetZoom Which ensures that values are only within the bounds specified in the help file.    I found that if I comment out the portion of the code that limits the values, the function works fine for most (if not all) values.   I changed the code in the library file to this by simply commenting out the restricting lines of code:
      ; #FUNCTION# ==================================================================================================================== ; Authors........: Chris Haslam (c.haslam) ; Modified ......: ; =============================================================================================================================== Func _GUICtrlRichEdit_SetZoom($hWnd, $iPercent) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(101, 0, False) If Not __GCR_IsNumeric($iPercent, ">0") Then Return SetError(1021, 0, False) Local $iNumerator, $iDenominator Select ; Case Not ($iPercent = 100 Or ($iPercent >= 200 And $iPercent < 6400)) ; Return SetError(1022, 0, False) Case $iPercent >= 100 $iNumerator = 10000 $iDenominator = 10000 / ($iPercent / 100) Case Else $iNumerator = 10000 * ($iPercent / 100) $iDenominator = 10000 EndSelect Return _SendMessage($hWnd, $EM_SETZOOM, $iNumerator, $iDenominator) <> 0 EndFunc ;==>_GUICtrlRichEdit_SetZoom  
      I assume whatever windows bug existed at the time this was created, no longer exists so there is no need to restrict the values.   
      Just wanted to point this out if anyone else is using this part of the library and required this functionality like I did.
       
    • wakillon
      By wakillon
      Polaroider 1.0.3.1
      Easily Create a picture as a Polaroid and be able after, to create Custom Photos Polaroid Collage.
      May be you know Pola a soft for create easily Polaroid-like photos from your digital images, but after some tries, i didn't find it very handy !
      So i made mine.
       

      Photo can be positioned by drag and zoomed/unzoomed with mouse wheel ( sorry for Touchpad user    )
      Polaroid can be inclined 10 or 20 degrees, on left or right, and with simple or multiple frames.
      Inclination will only be visible on the saved shoot.
      It is also saved with a transparent background for be able to create "Pêle-Mêles" (in french) with a photo editor.
      I have set the desktop as save directory.
      previous downloads : 122
       
      source and executable are available in the Download Section
      All files are included in script.
      I hope you will like it !
      Happy Shooting ! 
    • wakillon
      By wakillon
      Easily Create a picture as a Polaroid and be able after, to create Custom Photos Polaroid Collage.
       
      Photo can be positioned by drag and zoomed/unzoomed with mouse wheel ( sorry for Touchpad user )
      Polaroid can be inclined 10 or 20 degrees, on left or right, and with simple or multiple frames.
      Inclination will only be visible on the saved shoot.
      It is also saved with a transparent background for be able to create "Pêle-Mêles" (in french) with a photo editor.
      I have set the desktop as save directory.
       
    • clarinets101
      By clarinets101
      I know the rules, don't ask for people to write your script for you.. i just need a nudge in the right direction or just tell me if it's not possible.  Here's the skinny, I have an application that shows maps of different areas.  I need to have four areas displayed on the screen, the problem I have is the window isn't laid out well to manipulate the window(s) to easily display the maps.  My thoughts are if i can have each map where it can be seen then map out the coordinates to a "magnification tool" of some sort and re-display it in it's on GUI quartered out on the screen with the "screwed" up maps in the background as there is only one monitor hooked to these computers.  I have been unable to find much on something like this, except for an old post referring to an iGZoom which I think was from back in 2005 and I haven't been able to find anything else on it.  If have performed multiple search queries so I figured I would go ahead and ask the experts.

      Thank you