SEKOMD Posted 9 hours ago Share Posted 9 hours ago (edited) I managed to delete the title, but a white trace of it remains. Is it possible to delete it? It is important that the window shadow remains... sorry for my english please! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> ;exit func HotKeySet('{ESC}', 'Terminate') Func Terminate() Exit EndFunc ;==>Terminate $hGUI = GUICreate('', 400, 400, 400, 400, BitOR($WS_POPUP, $WS_THICKFRAME)) GUISetBkColor($COLOR_RED,$hGUI) GUISetState(@SW_SHOW,$hGUI) While Sleep(1000) WEnd Edited 9 hours ago by SEKOMD Link to comment Share on other sites More sharing options...
ioa747 Posted 6 hours ago Share Posted 6 hours ago remove $WS_THICKFRAME I know that I know nothing Link to comment Share on other sites More sharing options...
pixelsearch Posted 6 hours ago Share Posted 6 hours ago (edited) 31 minutes ago, ioa747 said: remove $WS_THICKFRAME Hi ioa747, maybe he can't do this, because the GUI should stay resizable ? Does the following script work for you, registering WM_NCPAINT to paint the GUI frame when needed : expandcollapse popup#include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> Global $g_iGuiBkColor = $COLOR_RED $hGUI = GUICreate('', 400, 300, -1, -1, BitOR($WS_POPUP, $WS_THICKFRAME)) ; $WS_THICKFRAME same as $WS_SIZEBOX GUISetBkColor($g_iGuiBkColor, $hGUI) GUIRegisterMsg($WM_NCPAINT, "WM_NCPAINT") ; before GUISetState (+++) . Interesting to test it just after GUISetState ! GUISetState(@SW_SHOW, $hGUI) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Esc will terminate (as no close button in this GUI) ;============================================ Func WM_NCPAINT($hWnd, $iMsg, $wParam, $lParam) Local $hDC, $hPen, $OldPen, $hBrush, $OldBrush, $aHwndPos, $tRECT $hDC = _WinAPI_GetWindowDC($hWnd) $hPen = _WinAPI_CreatePen($PS_SOLID, 5, _RGB2BGR($g_iGuiBkColor)) ; 5 should be enough for a thick GUI border $OldPen = _WinAPI_SelectObject($hDC, $hPen) $hBrush = _WinAPI_GetStockObject($NULL_BRUSH) ; same as $HOLLOW_BRUSH $OldBrush = _WinAPI_SelectObject($hDC, $hBrush) $aHwndPos = WinGetPos($hWnd) $tRECT = _WinAPI_CreateRect(1, 1, $aHwndPos[2], $aHwndPos[3]) _WinAPI_Rectangle($hDC, $tRECT) ; draw the rectangle _WinAPI_SelectObject($hDC, $OldBrush) _WinAPI_SelectObject($hDC, $OldPen) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC($hWnd, $hDC) Return 0 ; works (GUI border got the same color as GUI background color) ; Return 1 ; works ; Return $GUI_RUNDEFMSG ; doesn't work (GUI border is visible in its native color) ; Return ; doesn't work (i think Return $GUI_RUNDEFMSG or Return always have the same effect) EndFunc ;==>WM_NCPAINT ;============================================ Func _RGB2BGR($iColor) Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF) EndFunc ;==>_RGB2BGR Edited 6 hours ago by pixelsearch typo ioa747 1 Link to comment Share on other sites More sharing options...
ioa747 Posted 5 hours ago Share Posted 5 hours ago @pixelsearch i don't see any difference the title part keeps showing up Windows 10 Pro Version 22H2 @SEKOMD what's up with you? is everything ok? I know that I know nothing Link to comment Share on other sites More sharing options...
pixelsearch Posted 4 hours ago Share Posted 4 hours ago @ioa747 unfortunately it happens that scripts which work very fine with oldest OS's (my computer) don't work anymore with new OS's. I won't be able to test it on a Win11 machine until Sunday, but as you wrote it doesn't work on Win10 then it probably won't work on Win11 Here is the link of the script (from rasim) that I used to rescript what's in my preceding post. ioa747 1 Link to comment Share on other sites More sharing options...
pixelsearch Posted 4 hours ago Share Posted 4 hours ago (edited) @ioa747 Before posting my script, I tested different values in this line : $hPen = _WinAPI_CreatePen($PS_SOLID, 5, _RGB2BGR($g_iGuiBkColor)) ; 5 should be enough for a thick GUI border 1 (instead of 5) didn't work for me as a big part of the GUI border wasn't repainted (just 1 unit was repainted) 5 did work for me, but I also tested 10 and 20, which worked also (it didn't "enlarge" the GUI). Could you test the script with 10 or 20, in case it solves it on Win10 ? Thanks Edited 4 hours ago by pixelsearch Link to comment Share on other sites More sharing options...
ioa747 Posted 4 hours ago Share Posted 4 hours ago 4 minutes ago, pixelsearch said: Could you test the script with 10 or 20, I tried it, I also put another color so that it is visible, but I can't see it anywhere. I'm still searching SEKOMD 1 I know that I know nothing Link to comment Share on other sites More sharing options...
pixelsearch Posted 4 hours ago Share Posted 4 hours ago Results on my computer, in the pic above : * Left = OP's script (white border fully visible in this Popup GUI having a size border) * Mid = WM_NCPAINT with a Pen having a width of 1 unit (only a part of the border is red) * Right = WM_NCPAINT with a Pen having a width of 5 units (all the border is red) For what it's worth... SEKOMD 1 Link to comment Share on other sites More sharing options...
SEKOMD Posted 4 hours ago Author Share Posted 4 hours ago (edited) pixelsearch, ioa747 thank you for trying to help!!! It seems to me that it is impossible to remove the rest of the header. That would be great though. (painting in one color is not suitable) For now, the solution is to create a separate shadow (maybe someone find it useful): expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <GDIPlus.au3> #include <WinAPISysWin.au3> ;exit func HotKeySet('{ESC}', 'Terminate') Func Terminate() Exit EndFunc ;==>Terminate $hGUI_Shadow = GUICreate('', 0, 0, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) $hGUI = GUICreate('', 400, 400, 300, 300, $WS_POPUP, Default, $hGUI_Shadow) GUISetBkColor($COLOR_RED, $hGUI) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Shadow) ;create shadow :) _GDIPlus_Startup() _WinAPI_UpdateLayeredWindowEx($hGUI_Shadow, 300-20, 300-20, _CreateDropShadow(400, 400, 20, 0xFF000000), 60, 1) _GDIPlus_Shutdown() While Sleep(1000) WEnd ;============== code by Yashied (author) ==================== Func _CreateDropShadow($iWidth, $iHeight, $iRadius, $iARGB = 0) Local $hGraphic, $hBrush, $hImage, $hBitmap Local $aPart[4][5] = _ [[$iRadius, 0, $iWidth, $iRadius, -90], _ [$iWidth + $iRadius, $iRadius, $iRadius, $iHeight, 0], _ [$iRadius, $iHeight + $iRadius, $iWidth, $iRadius, 90], _ [0, $iRadius, $iRadius, $iHeight, 180]] $hImage = _GDIPlus_BitmapCreateFromScan0($iWidth + 2 * $iRadius, $iHeight + 2 * $iRadius) If Not $hImage Then Return 0 EndIf $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsClear($hGraphic, 0) $hBrush = _GDIPlus_BrushCreateSolid($iARGB) _GDIPlus_GraphicsFillRect($hGraphic, $iRadius, $iRadius, $iWidth, $iHeight, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDrawRadialGradient($hGraphic, $iRadius, $iRadius, $iRadius, $iARGB, BitAND($iARGB, 0x00FFFFFF), -180, -90) _GDIPlus_GraphicsDrawRadialGradient($hGraphic, $iWidth + $iRadius, $iRadius, $iRadius, $iARGB, BitAND($iARGB, 0x00FFFFFF), -90, 0) _GDIPlus_GraphicsDrawRadialGradient($hGraphic, $iWidth + $iRadius, $iHeight + $iRadius, $iRadius, $iARGB, BitAND($iARGB, 0x00FFFFFF), 0, 90) _GDIPlus_GraphicsDrawRadialGradient($hGraphic, $iRadius, $iHeight + $iRadius, $iRadius, $iARGB, BitAND($iARGB, 0x00FFFFFF), 90, 180) For $i = 0 To 3 $tRect = DllStructCreate($tagGDIPRECTF) For $j = 0 To 4 DllStructSetData($tRect, $j + 1, $aPart[$i][$j]) Next $hBrush = _GDIPlus_LineBrushCreateFromRectWithAngle($tRect, $iARGB, BitAND($iARGB, 0x00FFFFFF), $aPart[$i][4], 0, 3) _GDIPlus_GraphicsFillRect($hGraphic, $aPart[$i][0], $aPart[$i][1], $aPart[$i][2], $aPart[$i][3], $hBrush) _GDIPlus_BrushDispose($hBrush) Next $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) Return $hBitmap EndFunc ;==>_CreateDropShadow Func _GDIPlus_GraphicsDrawRadialGradient($hGraphics, $iX, $iY, $iRadius, $iARGB1, $iARGB2, $iStartAngle = 0, $iEndAngle = 360, $iStep = 5) If $iStep < 1 Then $iStep = 1 EndIf Local $Xi = $iX - $iRadius, $Yi = $iY - $iRadius, $Di = 2 * $iRadius Local $hBrush, $hMatrix, $Smooth = _GDIPlus_GraphicsGetSmoothingMode($hGraphics) Local $Start = True _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 0) $hBrush = _GDIPlus_LineBrushCreate(0, 0, $iRadius, 0, $iARGB1, $iARGB2, 3) $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $iX, $iY) While $iStartAngle < $iEndAngle If $iStartAngle + $iStep > $iEndAngle Then $iStep = $iEndAngle - $iStartAngle EndIf If $Start Then _GDIPlus_MatrixRotate($hMatrix, $iStartAngle + $iStep / 2) $Start = False Else _GDIPlus_MatrixRotate($hMatrix, $iStep) EndIf _GDIPlus_LineBrushSetTransform($hBrush, $hMatrix) _GDIPlus_GraphicsFillPie($hGraphics, $Xi, $Yi, $Di, $Di, $iStartAngle, $iStep, $hBrush) $iStartAngle += $iStep WEnd _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $Smooth) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_BrushDispose($hBrush) Return 1 EndFunc ;==>_GDIPlus_GraphicsDrawRadialGradient sorry for my english... Edited 4 hours ago by SEKOMD ioa747 and pixelsearch 2 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