Taz77 Posted June 28, 2015 Share Posted June 28, 2015 Hi, since days I have a problem which I get not solved.The problem is that the content of the second GUI does not show in the Live Preview, when the window is minimized.(The second GUI is, required to get the transparency for the GUI) That is the example GUI: So it looks right: But when the GUI is minimized, looks like this: Source Code:expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Func _MaxInt($iNum1, $iNum2) Return ($iNum1 > $iNum2) ? $iNum1 : $iNum2 EndFunc Func _SetBmp($hGUI, $hImage, $iWidth, $iHeight, $iOpacity = 255) Local $hScrDC = _WinAPI_GetDC($hGUI) Local $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) Local $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) Local $tSize = DllStructCreate("long X;long Y") Local $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $iWidth) DllStructSetData($tSize, "Y", $iHeight) Local $tSource = DllStructCreate("long X;long Y") Local $pSource = DllStructGetPtr($tSource) Local $tBlend = DllStructCreate("byte Op;byte Flags;byte Alpha;byte Format") Local $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 0x02) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc Func _DrawItems(ByRef $hImage, $iWidth, $iHeight, $hGui) Local Enum $Bitmap, $x, $y, $Width, $Height #forceref $x, $y Local $aData[9][5] = [[0, 0, 0, 76, 76],[0, 77, 0, 1, 60],[0, 87, 0, 96, 76],[0, 0, 76, 76, 1],[1, 0, 0, 0, 0], [0, 87, 76, 96, 1],[0, 0, 87, 76, 87],[0, 77, 87, 1, 87],[0, 87, 87, 96, 87]] Local $WidthSteps = _MaxInt(Round(($iWidth - ($aData[0][$Width] + $aData[2][$Width])) / $aData[1][$Width], 0), 0) Local $HeightSteps = _MaxInt(Round(($iHeight - ($aData[0][$Height] + $aData[6][$Height])) / $aData[3][$Height], 0), 0) Local $WidthTotal = $aData[0][$Width] + $aData[2][$Width] + ($WidthSteps * $aData[1][$Width]) Local $HeightTotal = $aData[0][$Height] + $aData[6][$Height] + ($HeightSteps * $aData[3][$Height]) Local $hWindow = _GDIPlus_GraphicsCreateFromHWND($hGui) Local $hBmp = _GDIPlus_BitmapCreateFromGraphics($WidthTotal, $HeightTotal, $hWindow) Local $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBmp) Local $hBrush = _GDIPlus_LineBrushCreateFromRect(_GDIPlus_RectFCreate(0, 0, $iWidth, $iHeight), 0xFF009917, 0xFF0F6029, 1) For $i = 0 To UBound($aData) - 1 If $aData[$i][0] <> 1 Then $aData[$i][0] = _GDIPlus_BitmapCloneArea($hImage, $aData[$i][1], $aData[$i][2], $aData[$i][3], $aData[$i][4], $GDIP_PXF32ARGB) EndIf Next _GDIPlus_GraphicsFillRect($hGraphic, 30, 30, $iWidth-80, $iHeight-70, $hBrush) ; Left: Top, Bottom _GDIPlus_GraphicsDrawImageRect($hGraphic, $aData[0][$Bitmap], 0, 0, $aData[0][$Width], $aData[0][$Height]) _GDIPlus_GraphicsDrawImageRect($hGraphic, $aData[6][$Bitmap], 0, $HeightTotal-$aData[6][$Height], $aData[6][$Width], $aData[6][$Height]) ; Right: Top, Bottom _GDIPlus_GraphicsDrawImageRect($hGraphic, $aData[2][$Bitmap], $WidthTotal-$aData[2][$Width], 0, $aData[2][$Width], $aData[2][$Height]) _GDIPlus_GraphicsDrawImageRect($hGraphic, $aData[8][$Bitmap], $WidthTotal-$aData[8][$Width], $HeightTotal-$aData[8][$Height], $aData[8][$Width], $aData[8][$Height]) ; Center: Top, Bottom For $i = 0 To $WidthSteps - 1 _GDIPlus_GraphicsDrawImageRect($hGraphic, $aData[1][$Bitmap], $aData[0][$Width] + ($i * $aData[1][$Width]), 0, $aData[1][$Width], $aData[1][$Height]) _GDIPlus_GraphicsDrawImageRect($hGraphic, $aData[7][$Bitmap], $aData[3][$Width] + ($i * $aData[7][$Width]), $HeightTotal - $aData[7][$Height], $aData[7][$Width], $aData[7][$Height]) Next ; Center: Left, Right For $i = 0 To $HeightSteps - 1 _GDIPlus_GraphicsDrawImageRect($hGraphic, $aData[3][$Bitmap], 0, $aData[0][$Height] + ($i * $aData[3][$Height]), $aData[3][$Width], $aData[3][$Height]) _GDIPlus_GraphicsDrawImageRect($hGraphic, $aData[5][$Bitmap], $WidthTotal - $aData[5][$Width], $aData[2][$Height] + ($i * $aData[5][$Height]), $aData[5][$Width], $aData[5][$Height]) Next For $i = 0 To UBound($aData) - 1 If $aData[$i][0] <> 1 Then _GDIPlus_ImageDispose($aData[$i][0]) EndIf Next _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hWindow) Return $hBmp EndFunc _GDIPlus_Startup() Global $Image = _GDIPlus_ImageLoadFromFile(StringRegExpReplace(@AutoItExe, "(?i)AutoIt(?:[\dx_]+)\.exe", "Examples\\GUI\\Torus.png")) Global $Width = 500, $Height = 300 Global $Gui = GUICreate("Test Gui", $Width, $Height, -1, -1, BitOR($WS_POPUP, $WS_GROUP, $WS_SYSMENU), $WS_EX_LAYERED) Global $Bmp = _DrawItems($Image, $Width, $Height, $Gui) _SetBmp($Gui, $Bmp, $Width, $Height) _GDIPlus_ImageDispose($Image) _GDIPlus_ImageDispose($Bmp) Global $Child = GUICreate("", $Width-10, $Height-10, 10, 10, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $Gui) GUISetBkColor(0x000000, $Child) _WinAPI_SetLayeredWindowAttributes($Child, 0x000000, 255) GUICtrlCreateLabel("Where is the text and the buttons in the Live Preview, when the window is minimized?", 50, 58, 360, 152) GUICtrlSetFont(-1, 22, 800, 0, "Comic Sans Ms") GUICtrlSetColor(-1, 0xEEEEEE) Global $BtnExit = GUICtrlCreateButton("Exit", 150, 246, 100, 25) Global $BtnMinimize = GUICtrlCreateButton("Minimize", 260, 246, 100, 25) GUISetState(@SW_SHOW, $Gui) GUISetState(@SW_SHOW, $Child) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $BtnExit ExitLoop Case $BtnMinimize WinSetState($Gui, "", @SW_MINIMIZE) EndSwitch WEnd _GDIPlus_Shutdown() GUIDelete($Gui) GUIDelete($Child) I hope you can help mePS: Sorry my English is not really good Dropbox - Sign up and get an extra 500MB Link to comment Share on other sites More sharing options...
texan Posted July 21, 2015 Share Posted July 21, 2015 Did you ever figure this out? I have a similar issue. Noticed it only occurs when using a basic theme in Windows 7 but works fine when using one of the Aero themes. Link to comment Share on other sites More sharing options...
Taz77 Posted July 25, 2015 Author Share Posted July 25, 2015 No, no solution is found Dropbox - Sign up and get an extra 500MB Link to comment Share on other sites More sharing options...
Taz77 Posted March 17, 2016 Author Share Posted March 17, 2016 The problem still exists, can anyone help? Dropbox - Sign up and get an extra 500MB Link to comment Share on other sites More sharing options...
UEZ Posted March 17, 2016 Share Posted March 17, 2016 Why do you think that this preview issue is related to AutoIt? 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Taz77 Posted March 17, 2016 Author Share Posted March 17, 2016 I think so, it works on your PC? I have test it on windows 7 64 bit. Dropbox - Sign up and get an extra 500MB Link to comment Share on other sites More sharing options...
UEZ Posted March 17, 2016 Share Posted March 17, 2016 (edited) Not working on Win8 / Win10. Why don't you draw the text onto the bitmap and display only one GUI? Edited March 17, 2016 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Taz77 Posted March 17, 2016 Author Share Posted March 17, 2016 Because it is complex GUI, with many labels, buttons, lists... And i want to make a template, so I can use Koda, to create easy guis, with this style. Dropbox - Sign up and get an extra 500MB 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