Jump to content

[solved] get border details: transparent or not ?


Recommended Posts

image.png.b22a2c2f0059b80406a2867fd8475457.png

On the left image there is a visible border, on the right image the border is transparent.

is there a _WinAPI_GetMeIfTheBorderIsTransparentOrSolid() that I can use to ask the OS ?

Thanks

Edit: just in case my pic. is not clear
53257-upload.jpg
from another one looking at the same question at docs.microsoft.com .

Edited by argumentum
solved

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

#include <APIGdiConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIGdi.au3>
#include <GUIConstantsEx.au3>

Func _WinGetBorder($hWnd)

    Local $iExtended = 0, $aWinPos = WinGetPos($hWnd)
    If @error Then Return SetError(1, 0, 0)

    Local $aWinClientSize = WinGetClientSize($hWnd)
    If @error Then Return SetError(2, 0, 0)

    If _WinAPI_DwmIsCompositionEnabled() Then
        Local $aPosFromRect = _WinAPI_GetPosFromRect(_WinAPI_DwmGetWindowAttribute($hWnd, $DWMWA_EXTENDED_FRAME_BOUNDS))
        If Not @error Then
            If $aWinPos[2] <> $aPosFromRect[2] Then $iExtended = 1 ; border is transparent
        EndIf
    EndIf

    Local $iBorder = (($aWinPos[2] - $aWinClientSize[0]) / 2)
;~  Local $iHeader = $aWinPos[3] - $aWinClientSize[1] - $iBorder
    Return SetError(0, $iExtended, $iBorder)
EndFunc

Example()
Func Example()
    Local $hGUI = GUICreate("Example")
    Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25)
    Local $idIsItTranparent = GUICtrlCreateLabel("",30, 30, 300, 200)
    GUISetState(@SW_SHOW, $hGUI)

    ; Showcase _WinGetBorder()
    Local $iIsTransparent, $iBorder = _WinGetBorder($hGUI)
    $iIsTransparent = @extended
    GUICtrlSetData($idIsItTranparent, "Border = " & $iBorder & _
        " px.   /    Transparent = " & ($iIsTransparent = 1 ? "yes" : "no") )


    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idOK
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($hGUI)
EndFunc   ;==>Example

The answer to my question is in @extended

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...