zackrspv Posted June 15, 2009 Share Posted June 15, 2009 (edited) I loved this post by DreamFire, which would create a GUI window using the 'somewhat' accurate layout of a STEAM window. I love the colors, the look, feel. But, one thing I had to fault him on was that you couldn't tell it to create it at X/Y position, with extra styles, embed a parent, etc. Even the graphics were fixed, and were not intelligent enough to figure out how wide/short they should be.So, i created this one. Here's the function definition:expandcollapse popup;=============================================================================== ; Function Name: _makeWindow() ; Description: Generate a steam window with independant controls ; Parameter(s): $sWINDOW_TITLE = "" Title of Window ; $MainSectionText = "Content" Content Area Header ; $iWINDOW_WIDTH = 200 Window Width ; $iWINDOW_HEIGHT = 200 Window Height ; $iWINDOW_X = -1 Window X Position ; $iWINDOW_Y = -1 Window Y Position ; $iwinShow = True Window is visible ; $iWINDOW_STYLE = "" Window Style ; $iWINDOW_xSTYLE = "" Window Extended Style ; $iParent = "" Window Parent ; $iPath = "" Image Path ; Requirement(s): n/a ; Return Value(s): On Success - Returns Array containing: ; - Window Handle, element 0 ; - Left Panel Width, element 1 ; - Content Area Start, element 2 ; - Window Header, element 3 ; - Content Area Header, element 4 ; - Window Close Handle, element 5 ; On Failure - Returns -1 and sets @error: ; - 1 = Missing hdr.bmp ; - 2 = Missing cls.bmp ; - 3 = Missing cnr.bmp ; - 4 = Invalid Parent Window ; - 5 = Could not create window ; Remarks: It's best to use the GuiGetMsg(1) array to process ; windows created with this command. If you process ; the initial array [0], for example, to check if a window ; is to be closed, then you can parse the [1] array to see ; if the close window command is comming from a specific ; window, or the application in whole. It stops making ; you close a window, and exit the entire app at the same ; time. See the UDF post on AutoIT Forums for the proper ; use of the while/wend/message loop :) ; Link: ; Authors: Initial Script (not independant controls) - Dreamfire ; Edit for UDF and Code - zackrspv ;===============================================================================Some notes on the function: You can create as many windows as you want, just set the window handle to the handle of the window created in element 0 of the array you called to create it. You should proably use the advanced GuiGetMSG() handler to return what windows/controls called the events. This is useful if you wish to have a window that has a standard windows titlebar, while still having the steam custom one (i have no idea why anyone would do this, but hey lol) The command handles the left panel, content area, window sizes, all automatically. So the smaller you make the window, the smaller the areas become, instead of all being fixed. The command allows for controls to be added AFTER a window is created, and allows those controls to be useable. Before, in DreamFires script (which i liked his! this is not a bash!), you had to add the controls in the function, and modify the function before any would become useable (especially on the left panel).Here's an example:expandcollapse popup#include "swindow.au3" $tArray = _makeWindow('STEAM', 'Main', 100, 100, 100, 100) $Win1_wHandel = $tArray[0] $win1_lPanel = $tArray[1] $win1_cArea = $tArray[2] $win1_cHeader = $tArray[3] $win1_wHeader = $tArray[4] $win1_wClose = $tArray[5] $win1_Active = $tArray[6] $tArray = _makeWindow('STEAM', 'Test', 200, 200, -1, -1, False) $Win2_wHandel = $tArray[0] $win2_lPanel = $tArray[1] $win2_cArea = $tArray[2] $win2_cHeader = $tArray[3] $win2_wHeader = $tArray[4] $win2_wClose = $tArray[5] $win2_Active = $tArray[6] $tArray = _makeWindow('STEAM', 'Test', 1024, 768, -1, -1, True, $WS_SYSMENU + $WS_CAPTION) $Win3_wHandel = $tArray[0] $win3_lPanel = $tArray[1] $win3_cArea = $tArray[2] $win3_cHeader = $tArray[3] $win3_wHeader = $tArray[4] $win3_wClose = $tArray[5] $win3_Active = $tArray[6] ;- Example controls GUISwitch($Win1_wHandel) $test = GUICtrlCreateButton("Win2", 5, 25, $win1_lPanel - 6, 20);- left panel GUISwitch($Win2_wHandel) GUICtrlCreateCombo("test", $win2_lPanel + 13, 60, $win2_cArea - 26, 20, -1, 0);- content area While 1 Local $eMSG = GUIGetMsg(1) ;- Advanced message array Switch $eMSG[0] ;- Process main event/control handles Case $GUI_EVENT_CLOSE If $eMSG[1] = $Win3_wHandel Then ;- Checks to see if a window was closed and not the entire app GUIDelete($Win3_wHandel) $win3_Active = False Else ;- Command was generated for the app, not window Exit EndIf Case $win1_wClose GUIDelete($Win1_wHandel) $win1_Active = False Case $win2_wClose GUIDelete($Win2_wHandel) $win2_Active = False Case $win3_wClose GUIDelete($Win3_wHandel) $win3_Active = False case $test GUISetState(@SW_SHOW, $Win2_wHandel) $win2_Active = True EndSwitch WEndYou need all of the files attached to this post to make it work, and it will complain if they are missing Otherwise, i hope y'all enjoy hdr.bmpcls.bmpcnr.bmpsWindow.au3 Edited June 15, 2009 by zackrspv -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë ë§§ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
SkellySoul Posted June 15, 2009 Share Posted June 15, 2009 (edited) Nice... I whipped this up in 10 minutes and it's not finished or anything but this just shows that you don't need those image files although my exit button does need a better font oh and you can set this for positions and what not , Width, Height, X , Y #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> _Steam() While 1 Sleep(1000) WEnd Func _Steam($sTitle = "Steam" , $sWidth = 500 , $sHeight = 500 , $sX = Default , $sY = Default) $SteamWin = GUICreate($sTitle, $sWidth, $sHeight, $sX, $sY , $WS_SYSMENU + $WS_POPUP) GUISetBkColor(0x464646) $Bar = GUICtrlCreateLabel($sTitle , 0 , 0 , $sWidth -18, 18 , $SS_NOTIFY , $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont($Bar, 10, 400, 0, "Arial") GUICtrlSetColor($Bar , 0xD8DED3) GUICtrlSetBkColor($Bar , 0x5A6A50) $Exit = GUICtrlCreateLabel("X" , $sWidth -18 , 0 , 18 , 18 , $SS_CENTER) GUICtrlSetFont(-1, 10, 800, 0, "Arial Black") GUICtrlSetColor($Exit , 0xD8DED3) GUICtrlSetBkColor($Exit, 0x5A6A50) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $Exit Exit EndSwitch WEnd EndFunc Edited June 15, 2009 by SkellySoul Link to comment Share on other sites More sharing options...
Dreamfire Posted June 16, 2009 Share Posted June 16, 2009 Nice, i like it. You improved it nicely.. 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