GEOSoft Posted September 9, 2008 Share Posted September 9, 2008 (edited) Here is one that I found rather helpful today. Someone else may also be able to get some use of it. Just uncomment the example in the header to run the demo, expandcollapse popup; ;=============================================================================== ; Function Name: _GUISetOffsetSize() ; Description: Set the dimension of a window by referencing the size of another window ; Syntax: ; Parameter(s): $hWnd - Window to reference ; $iDim - If 0 (default) then returns the width else returns the height ; $iCurr - Add to the dimmension value (Default = 0). ; For use when you need to add the dimensions of 2 forms together ; Requirement(s): ; Return Value(s): - Success - Returns the dimension specified by $iDim ; - Failure ; Author(s): George (GEOSoft) Gedye ; Modification(s): ; Note(s): ; Example(s): Below #cs #include <WindowsConstants.au3> Opt ("GUICoordMode", 2) $Parent = GUICreate("Parent window", 400, 250) GUISetState() $W = _GUISetOffsetSize($Parent) $H = _GUISetOffsetSize($Parent, 1) $Child = GUICreate("Child Window", $W, $H -210, 0, 0, $WS_CHILD + $WS_DLGFRAME, -1, $Parent) GUISetBkColor(0xFF0000) $Y = _GUISetOffsetSize($Child,1) $H -= $Y $Child2 = GUICreate("Child Window 2", $W, $H, 0, $Y, $WS_CHILD + $WS_DLGFRAME, -1, $Parent) GUISetBKColor(0x0000FF) GUISetState(@SW_SHOW, $Child) GUISetState(@SW_SHOW, $Child2) While 1 If GUIGetMsg() = -3 Then Exit Wend #ce ;=============================================================================== Func _GUISetOffsetSize($hWnd,$iDim = 0,$iCurr = 0) If NOT IsHWnd($hWnd) Then Return SetError(1) If $iDim <> 1 Then $iDim = 0 Local $sArray = WinGetClientSize($hWnd) If $iDim = 0 Then Return $sArray[0] + $iCurr Return $sArray[1] + $iCurr EndFunc ;<==> _GUISetOffsetSize() ; Edited September 9, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted September 9, 2008 Author Share Posted September 9, 2008 Updated with error handling and a new function name. This function is for use when you can't use WinGetPos() for child windows such as when you have a relational setting for Opt("GUICoordMode"). WinGetPos() returns screen coordinates which are no good for settings that are relational to the client area of a parent GUI. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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