argumentum Posted April 9, 2021 Share Posted April 9, 2021 (edited) 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 from another one looking at the same question at docs.microsoft.com . Edited April 9, 2021 by argumentum solved Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted April 9, 2021 Author Share Posted April 9, 2021 expandcollapse popup#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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now