komalo Posted August 31, 2008 Share Posted August 31, 2008 in winSetstate i can set state to @SW_RESTORE but in WinGetState i can't get RESTORE State Return Value Success: Returns a value indicating the state of the window. Multiple values are added together so use BitAND() to examine the part you are interested in: 1 = Window exists 2 = Window is visible 4 = Window is enabled 8 = Window is active 16 = Window is minimized 32 = Window is maximized Failure: Returns 0 and sets @error to 1 if the window is not found. [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
APPLEEATER Posted August 31, 2008 Share Posted August 31, 2008 in winSetstate i can set state to @SW_RESTORE but in WinGetState i can't get RESTORE State Return Value Success: Returns a value indicating the state of the window. Multiple values are added together so use BitAND() to examine the part you are interested in: 1 = Window exists 2 = Window is visible 4 = Window is enabled 8 = Window is active 16 = Window is minimized 32 = Window is maximized Failure: Returns 0 and sets @error to 1 if the window is not found. To check if the window is not minimized, you would have to use this code: If WinGetState("Window Name") = 16 Then $isrestore = False ElseIf WinGetState("Window Name") = 32 Then $isrestore = False Else $isrestore = True EndIf It does depend on what part of a window being Restored you are trying to get... i could be if it is active, or the window passion as well and not being minimized/maximized Hope i helped =P Link to comment Share on other sites More sharing options...
MrCreatoR Posted August 31, 2008 Share Posted August 31, 2008 You should check with BitAND... #include <GuiConstantsEx.au3> $GUI = GUICreate("Test Script", 300, 200) GUISetState(@SW_SHOW, $GUI) $sTitle = "Test Script" MsgBox(64, "Results:", _ StringFormat("_WinGetStateString for <%s>...\n\n%s", $sTitle, _WinGetStateString($sTitle)), 0, $GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WinGetStateString($sTitle) Local $iWinState = WinGetState($sTitle) Local $sWinStates = "" If BitAND($iWinState, 1) = 1 Then $sWinStates &= "Window exists" & @LF If BitAND($iWinState, 2) = 2 Then $sWinStates &= "Window is visible " & @LF If BitAND($iWinState, 4) = 4 Then $sWinStates &= "Window is enabled" & @LF If BitAND($iWinState, 8) = 8 Then $sWinStates &= "Window is active" & @LF If BitAND($iWinState, 16) = 16 Then $sWinStates &= "Window is minimized" & @LF If BitAND($iWinState, 32) = 32 Then $sWinStates &= "Window is maximized" & @LF Return StringStripWS($sWinStates, 3) EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted August 31, 2008 Share Posted August 31, 2008 in winSetstate i can set state to @SW_RESTORE but in WinGetState i can't get RESTORE State Return Value Success: Returns a value indicating the state of the window. Multiple values are added together so use BitAND() to examine the part you are interested in: 1 = Window exists 2 = Window is visible 4 = Window is enabled 8 = Window is active 16 = Window is minimized 32 = Window is maximized Failure: Returns 0 and sets @error to 1 if the window is not found.I think you need the API function GetWindowPlacement which will fill a structure with data including the coordinates for the restore window size. You can't get the restore information from WinGetState AFAIK. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
MrCreatoR Posted August 31, 2008 Share Posted August 31, 2008 You can't get the restore information from WinGetState AFAIKIf i understand correctly the «Restore state», then this should work: #include <GuiConstantsEx.au3> $GUI = GUICreate("Test Script", 300, 200) GUISetState(@SW_SHOW, $GUI) ;GUISetState(@SW_MINIMIZE, $GUI) $sTitle = "Test Script" MsgBox(64, "Results:", _WinIsRestored($sTitle)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WinIsRestored($sTitle) Local $iWinState = WinGetState($sTitle) ;1 = Window exists ;2 = Window is visible ;16 = Window is minimized ;32 = Window is maximized If BitAND($iWinState, 1) = 1 And BitAND($iWinState, 2) = 2 And _ Not BitAND($iWinState, 16) = 16 And Not BitAND($iWinState, 32) = 32 Then Return True Return False EndFunc Otherwise i would like to know the definition of “Restored Window State”. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted September 1, 2008 Share Posted September 1, 2008 If i understand correctly the «Restore state», then this should work: #include <GuiConstantsEx.au3> $GUI = GUICreate("Test Script", 300, 200) GUISetState(@SW_SHOW, $GUI) ;GUISetState(@SW_MINIMIZE, $GUI) $sTitle = "Test Script" MsgBox(64, "Results:", _WinIsRestored($sTitle)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WinIsRestored($sTitle) Local $iWinState = WinGetState($sTitle) ;1 = Window exists ;2 = Window is visible ;16 = Window is minimized ;32 = Window is maximized If BitAND($iWinState, 1) = 1 And BitAND($iWinState, 2) = 2 And _ Not BitAND($iWinState, 16) = 16 And Not BitAND($iWinState, 32) = 32 Then Return True Return False EndFunc Otherwise i would like to know the definition of Restored Window State.I understood that the OP wanted to know what would happen if a window was restored. So I thought that would mean if the restore button was pressed or the @SW_RESTORE option was used in WInSetState, then what size would the window change to. That information isn't given by WinGetState, so I suggested GetWindowPlacement which I think can give the restore size. Maybe I didn't understand. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
komalo Posted September 2, 2008 Author Share Posted September 2, 2008 thank you all i will work with GetWindowPlacement [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 2, 2008 Share Posted September 2, 2008 thank you all i will work with GetWindowPlacementThat's _WinAPI_GetWindowPlacement() in the current Beta, BTW. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
komalo Posted September 2, 2008 Author Share Posted September 2, 2008 (edited) i don't need the function i can call it from dllcall it's not a problem for me of course i would prefer the beta but i have a dialup so it will take a while until i download it Edited September 2, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 2, 2008 Share Posted September 2, 2008 i don't need the function i can call it fromdllcall it's not a problem for me of course i would prefer the beta but i have a dialup so it will takea while until i download itYou could copy just the function from the topic it was created in: _WinAPI_GetWindowPlacement() Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
komalo Posted September 3, 2008 Author Share Posted September 3, 2008 thank you , i will get it now [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] 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