E1M1 Posted March 10, 2011 Posted March 10, 2011 (edited) I am trying to write my own window manager, but I can not find out why minimize, maximize and close aren't visible until I move window out of screen and then drag back. Could anyone tell me what should I do differently. Zip file contains images and source below. http://autoit.net.ee/downloads/windowmanager.zip expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <array.au3> #include <GUIConstantsEx.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> $var = WinList() OnAutoItExitRegister("Release") Dim $captured[1][7] $TitleHeight = _WinAPI_GetSystemMetrics($SM_CYCAPTION) $TitleHeight += _WinAPI_GetSystemMetrics($SM_CXFRAME) $BorderWidht = _WinAPI_GetSystemMetrics($SM_CYFRAME) For $i = 1 To $var[0][0] If $var[$i][0] <> "" And HasState($var[$i][1], 2) Then If $var[$i][0] <> "Program Manager" Then $size = WinGetPos($var[$i][0]) ReDim $captured[UBound($captured) + 1][7] $hGUI = GUICreate($var[$i][0], $size[2]-(2 * $BorderWidht), $size[3] - (2 * $BorderWidht) + 26, $size[0], $size[1], $WS_POPUP) GUISetState(@SW_SHOW) $gui2 = GUICreate("", $size[2] - (2 * $BorderWidht), $size[3] - (2 * $BorderWidht), 0, 26, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetState(@SW_SHOW) $captured[UBound($captured) - 1][6] = $hGUI $captured[UBound($captured) - 1][0] = $var[$i][1] $captured[UBound($captured) - 1][1] = _WinAPI_GetWindowLong($captured[UBound($captured) - 1][0], $GWL_STYLE) $captured[UBound($captured) - 1][2] = _WinAPI_GetWindowLong($captured[UBound($captured) - 1][0], $GWL_EXSTYLE) _WinAPI_SetWindowLong($captured[UBound($captured) - 1][0], $GWL_EXSTYLE, $WS_EX_MDICHILD) _WinAPI_SetWindowLong($captured[UBound($captured) - 1][0], $GWL_STYLE, $WS_POPUP+$WS_VISIBLE) _WinAPI_SetParent($captured[UBound($captured) - 1][0], $gui2) WinMove($captured[UBound($captured) - 1][0], "", -$BorderWidht, -$TitleHeight) ;~ WinActivate($captured[UBound($captured) - 1][0]) ConsoleWrite("Title: " & $var[$i][0] & " Handle: " & $captured[UBound($captured) - 1][0] & @CRLF) TitlebarCreate($hGUI, $var[$i][0], 23, 3, 24, 18) ;~ WinSetTrans($gui2,"",128) WinSetTrans($hGUI,"",128) EndIf EndIf Next While 1 ;~ $nmsg = GUIGetMsg() ;~ If $nmsg = -3 Then Exit ;~ for $i = 0 To UBound($captured) -1 ;~ If $captured[$i][3] = $nmsg Then WinSetState($captured[$i][6],"",@SW_MINIMIZE) ;~ Next WEnd Func HasState($handle, $iState) If BitAND(WinGetState($handle), $iState) Then Return 1 Else Return 0 EndIf EndFunc ;==>HasState Func Release() For $i = 0 To UBound($captured) - 1 _WinAPI_SetParent($captured[$i][0], 0) _WinAPI_SetWindowLong($captured[$i][0], $GWL_STYLE, $captured[$i][1]) _WinAPI_SetWindowLong($captured[$i][0], $GWL_EXSTYLE, $captured[$i][2]) WinActivate($captured[$i][0]) WinMove($captured[$i][0], "", 0, 0) Next EndFunc ;==>Release Func TitlebarCreate($hWnd, $Text, $height, $fromtop, $buttonW, $ButtonH) GUISwitch($hWnd) $pos = WinGetPos($hWnd) GUICtrlCreatePic(@ScriptDir & "\TitleBar.bmp", 0, 0, $pos[2], $height, BitOR($SS_NOTIFY, $WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG) ;~ GuiCtrlSetState(-1,$GUI_DISABLE) $captured[UBound($captured) - 1][3] = GUICtrlCreatePic(@ScriptDir & "\minimize.bmp", $pos[2] - 20 - ($buttonW * 3), $fromtop, $buttonW, $ButtonH,$WS_VISIBLE) $captured[UBound($captured) - 1][4] = GUICtrlCreatePic(@ScriptDir & "\maximize.bmp", $pos[2] - 17 - ($buttonW * 2), $fromtop, $buttonW, $ButtonH,$WS_VISIBLE) $captured[UBound($captured) - 1][5] = GUICtrlCreatePic(@ScriptDir & "\close.bmp", $pos[2] - 13 - ($buttonW), $fromtop, $buttonW, $ButtonH,$WS_VISIBLE) GUICtrlCreateLabel($Text, 7, $fromtop, StringLen($Text) * 11, Default, Default, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, -2) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) EndFunc ;==>TitlebarCreate Edited March 10, 2011 by E1M1 edited
Moderators Melba23 Posted March 10, 2011 Moderators Posted March 10, 2011 E1M1,There appears to be no relationship betwen the code you posted and the contents of the zip file you say has the source. Where, for example, is the raconfedit.eng.lng file? If you want help, try and make it a bit easier, please. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
E1M1 Posted March 10, 2011 Author Posted March 10, 2011 Oh sorry. For some reason I copied wrong source. Thank you for notifying me. Post updated edited
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