Daemante2018 Posted November 21, 2018 Share Posted November 21, 2018 (edited) I must be doing something wrong because I have searched and tried a number of different codes to restore a gui that I minimized. What I am trying to do is check if the window exists, and is minimized, then restore it or launch it. Using this very similar example it works as intended: #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $hWnd = "Untitled - Notepad" Local $iState = WinGetState($hWnd) If BitAND($iState, $WIN_STATE_MINIMIZED) Then WinSetState("Untitled - Notepad","", @SW_RESTORE) Else Run("notepad.exe") EndIf EndFunc ;==>Example Using my code it does not: #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> _lmin() Func _lmin() Local $launch = "Launcher" Local $iState = WinGetState($launch) If BitAND($iState, $WIN_STATE_MINIMIZED) Then WinSetState("Launcher", "", @SW_RESTORE) Else _Launcher() EndIf EndFunc ;==>_lmin The "window" is a gui that I opened and minimized. I have tried: GUICTRLGETSTATE / SETSTATE WINGETSTATE / SETSTATE WINACTIVATE / EXISTS Edited November 21, 2018 by Daemante2018 Link to comment Share on other sites More sharing options...
Nine Posted November 21, 2018 Share Posted November 21, 2018 I believe we gonna need more code than that. What is function _Launch ? Show us at least a screen shot of the "Window" ! “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Daemante2018 Posted November 21, 2018 Author Share Posted November 21, 2018 (edited) Right, my bad. Reason I didn't post the code is because the functionality is not allowed here and the function/GUI itself works without issue. Its just getting it to restore if minimized when the button is pressed again. expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <launchclient.au3> #include <EditConstants.au3> Func _Launcher($Launcher) $Launcher = GUICreate("Launcher", 662, 267, 649, 87) $PASSLEECH = GUICtrlCreateInput("Password", 360, 144, 273, 21, $ES_PASSWORD) GUICtrlSetTip(-1, "Password") GUICtrlSetCursor(-1, 5) $SAVEMAIN = GUICtrlCreateButton("Save", 224, 176, 75, 25) $SAVELEECH = GUICtrlCreateButton("Save", 560, 176, 75, 25) $PASSMAIN = GUICtrlCreateInput("Password", 24, 144, 273, 21, $ES_PASSWORD) GUICtrlSetTip(-1, "Password") GUICtrlSetCursor(-1, 5) $USERLEECH = GUICtrlCreateInput("Username", 360, 112, 273, 21, $ES_PASSWORD) GUICtrlSetTip(-1, "Username") GUICtrlSetCursor(-1, 5) $USERMAIN = GUICtrlCreateInput("Username", 24, 112, 273, 21, $ES_PASSWORD) GUICtrlSetTip(-1, "Username") GUICtrlSetCursor(-1, 5) $SHOWCRED1 = GUICtrlCreateCheckbox("Show Credentials", 24, 184, 97, 17) $SHOWCRED2 = GUICtrlCreateCheckbox("Show Credentials", 360, 184, 97, 17) $LeechText = GUICtrlCreateLabel("LEECH CLIENT", 432, 64, 138, 28) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $Warning = GUICtrlCreateLabel("ONLY use ""Windowed"" mode 1920x1080!", 152, 8, 369, 28) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $MainClient = GUICtrlCreateLabel("MAIN CLIENT", 96, 64, 122, 28) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $LAMAIN = GUICtrlCreateButton("L A U N C H", 24, 216, 275, 41) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xB9D1EA) GUICtrlSetCursor(-1, 0) $LALEECH = GUICtrlCreateButton("L A U N C H", 360, 216, 275, 41) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xB9D1EA) GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $ACCini = "accounts.ini" ;define ini file ;---------------------------------------------- ;Retrieve the ASCII value of the default password char ;---------------------------------------------- $DefaultUserLeech = GUICtrlSendMsg($USERLEECH, $EM_GETPASSWORDCHAR, 0, 0) $DefaultPassLeech = GUICtrlSendMsg($PASSLEECH, $EM_GETPASSWORDCHAR, 0, 0) $DefaultUserMain = GUICtrlSendMsg($USERMAIN, $EM_GETPASSWORDCHAR, 0, 0) $DefaultPassMain = GUICtrlSendMsg($PASSMAIN, $EM_GETPASSWORDCHAR, 0, 0) ;---------------------------------------------- GUISetState(@SW_SHOW, $Launcher) While 1 $nMsg = GUIGetMsg(1) If $nMsg[1] = $Launcher Then Switch $nMsg[0] Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $Launcher) ExitLoop Case $SHOWCRED1 ; main creds If (GUICtrlRead($SHOWCRED2) = $GUI_CHECKED) Then GUICtrlSendMsg($USERMAIN, $EM_SETPASSWORDCHAR, 0, 0) GUICtrlSendMsg($PASSMAIN, $EM_SETPASSWORDCHAR, 0, 0) GUICtrlSetData($USERMAIN, IniRead($ACCini, "Main Credentials", "Username", $USERNAMEMAIN)) GUICtrlSetData($PASSMAIN, IniRead($ACCini, "Main Credentials", "Password", $PASSWORDMAIN)) Else GUICtrlSendMsg($USERMAIN, $EM_SETPASSWORDCHAR, $DefaultUserMain, 0) GUICtrlSendMsg($PASSMAIN, $EM_SETPASSWORDCHAR, $DefaultPassMain, 0) GUICtrlSetData($USERMAIN, IniRead($ACCini, "Main Credentials", "Username", $USERNAMEMAIN)) GUICtrlSetData($PASSMAIN, IniRead($ACCini, "Main Credentials", "Password", $PASSWORDMAIN)) EndIf GUICtrlSetState($USERMAIN, $GUI_FOCUS) ;Input needs focus to redraw characters GUICtrlSetState($PASSMAIN, $GUI_FOCUS) ;Input needs focus to redraw characters Case $SAVEMAIN $USERNAMEMAIN = GUICtrlRead($USERMAIN) IniWrite($ACCini, "Main Credentials", "Username", $USERNAMEMAIN) $PASSWORDMAIN = GUICtrlRead($PASSMAIN) IniWrite($ACCini, "Main Credentials", "Password", $PASSWORDMAIN) MsgBox($MB_TOPMOST, "", "Credentials Saved!") Case $LAMAIN _Check4Main() ;check if windows already exists then call launch Case $SHOWCRED2 ; leech creds If (GUICtrlRead($SHOWCRED1) = $GUI_CHECKED) Then GUICtrlSendMsg($USERLEECH, $EM_SETPASSWORDCHAR, 0, 0) GUICtrlSendMsg($PASSLEECH, $EM_SETPASSWORDCHAR, 0, 0) GUICtrlSetData($USERLEECH, IniRead($ACCini, "Leech Credentials", "Username", $USERNAMELEECH)) GUICtrlSetData($PASSLEECH, IniRead($ACCini, "Leech Credentials", "Password", $PASSWORDLEECH)) Else GUICtrlSendMsg($USERLEECH, $EM_SETPASSWORDCHAR, $DefaultUserLeech, 0) GUICtrlSendMsg($PASSLEECH, $EM_SETPASSWORDCHAR, $DefaultPassLeech, 0) GUICtrlSetData($USERLEECH, IniRead($ACCini, "Leech Credentials", "Username", $USERNAMELEECH)) GUICtrlSetData($PASSLEECH, IniRead($ACCini, "Leech Credentials", "Password", $PASSWORDLEECH)) EndIf GUICtrlSetState($USERLEECH, $GUI_FOCUS) ;Input needs focus to redraw characters GUICtrlSetState($PASSLEECH, $GUI_FOCUS) ;Input needs focus to redraw characters Case $SAVELEECH $USERNAMELEECH = GUICtrlRead($USERLEECH) IniWrite($ACCini, "Leech Credentials", "Username", $USERNAMELEECH) $PASSWORDLEECH = GUICtrlRead($PASSLEECH) IniWrite($ACCini, "Leech Credentials", "Password", $PASSWORDLEECH) MsgBox($MB_TOPMOST, "", "Credentials Saved!") Case $LALEECH _Check4Leech() ;check if windows already exists then call launch EndSwitch EndIf WEnd EndFunc ;==>_Launcher Edit: Just noticed that the window in question is not being focused if you click anywhere off of it. Edited November 21, 2018 by Daemante2018 Link to comment Share on other sites More sharing options...
Nine Posted November 21, 2018 Share Posted November 21, 2018 what do you mean with "Reason I didn't post the code is because the functionality is not allowed here" ? and lmin will never be executed because launcher is the one running. it is working with notepad since it is a seperate process... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Developers Jos Posted November 21, 2018 Developers Share Posted November 21, 2018 @Daemante2018, So we tell you that a game launcher isn't allowed to be discussed here and to read our forum rules. It appears that forgot to read those rules as it clearly stated: Quote 7. Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above. Consider this your last warning and reminder to properly read these rules. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 21, 2018 Moderators Share Posted November 21, 2018 @Daemante2018 I am going to up the ante and give you 3 days to think it over before you are able to post again, since we had a pretty lengthy conversation via PM and I expressly told you NOT to try this. FrancescoDiMuro 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts