Belini Posted June 7, 2017 Share Posted June 7, 2017 I know that _WinAPI_ShowWindow () uses windows APIs to display windows and does exactly the same as GuiSetState () does and I did not find the source of GuiSetState () to compare, can anyone explain me what is the difference between the two functions? My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Fabio_iGames Posted June 8, 2017 Share Posted June 8, 2017 I would also love to know the difference. I have always used GuiSetState () but I started using _WinAPI_ShowWindow () and I would also like to know if there are any differences between the functions. ?????? Link to comment Share on other sites More sharing options...
Danyfirex Posted June 8, 2017 Share Posted June 8, 2017 Hello. It is a wrapper of _WinAPI_ShowWindow. Of course GuiSetState do other things internally. But Yes it use ShowWindow API call. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Belini Posted June 9, 2017 Author Share Posted June 9, 2017 (edited) @Danyfirex so their functions are the same, just change the name, right! MENSAG_01: W_05_07_17 Edited June 30, 2017 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Fabio_iGames Posted June 9, 2017 Share Posted June 9, 2017 @Danyfire So is it better to use _WinAPI_ShowWindow ? Or GuiSetState () Or Whatever ? Thank you Link to comment Share on other sites More sharing options...
Danyfirex Posted June 9, 2017 Share Posted June 9, 2017 Belini Basically yes. Fabio. keep using GUISetState. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Developers Jos Posted June 9, 2017 Developers Share Posted June 9, 2017 (edited) There is indeed no real difference other than GuiShow() will default to the last Handle of an internal created GUI and use @SW_SHOW as default. Simple demonstration: #include <GUIConstantsEx.au3> #include <winapi.au3> Example() Func Example() $hwd=GUICreate("My GUI") ; start the definition GUISetState() ; will display an empty dialog box sleep(2000) _WinAPI_ShowWindow($hwd,@SW_HIDE ) sleep(2000) _WinAPI_ShowWindow($hwd,@SW_SHOW ) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example The whole WinAPI stuff was only added at a later date and GuiShow() was obviously part of the GUI development JPM did. You will find several overlaps between Internal Functions and UDF's .. but also between UDF's for that matter, like a list of Date functions. Jos Edited June 9, 2017 by 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...
Belini Posted June 9, 2017 Author Share Posted June 9, 2017 Thanks to all who answered, I will choose to use GUISetState() then! My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
InnI Posted June 10, 2017 Share Posted June 10, 2017 Run this script. Click button two-three times to hide/show window $gui = GUICreate("wnd", 200, 200) $btn = GUICtrlCreateButton("click me", 50, 50, 100, 30) GUISetState() Do Switch GUIGetMsg() Case -3 Exit Case $btn GUISetState(@SW_HIDE) GUICtrlSetData($btn, "click again") Sleep(500) GUISetState(@SW_SHOW) EndSwitch Until 0 Now change string GUISetState(@SW_SHOW) to _WinAPI_ShowWindow($gui, @SW_SHOW) ; GUISetState(@SW_SHOW) _WinAPI_ShowWindow($gui, @SW_SHOW) And try again (button does not work after showing the window) It looks like function GUISetState does a little more than just displays the window. Link to comment Share on other sites More sharing options...
Belini Posted June 10, 2017 Author Share Posted June 10, 2017 (edited) @InnI actually happens what you said and only hid when I used _WinAPI_ShowWindow ($ gui, @SW_HIDE) so when using _WinAPI_ShowWindow () to show you have to use _WinAPI_ShowWindow () to hide and this makes me think that the functions are not the same as I thought? Does anyone have the function code GuisetSte () to make the comparison? #include <WinAPI.au3> $gui = GUICreate("wnd", 200, 200) $btn = GUICtrlCreateButton("click me", 50, 50, 100, 30) GUISetState() Do Switch GUIGetMsg() Case -3 Exit Case $btn ; GUISetState(@SW_HIDE) _WinAPI_ShowWindow($gui, @SW_HIDE) GUICtrlSetData($btn, "click again") Sleep(500) ;GUISetState(@SW_SHOW) _WinAPI_ShowWindow($gui, @SW_SHOW) EndSwitch Until 0 Jos: Please stick to English so we all understand the discussion: Quote @InnI really happens what you said and only hid when I used _WinAPI_ShowWindow ($ gui, @SW_HIDE) so when using _WinAPI_ShowWindow () to show, you should use _WinAPI_ShowWindow () to hide and this makes me think that functions do not Are they the same as I thought? Does anyone have the GuisetSte () function code to do the comparison? Edited June 10, 2017 by Jos My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Developers Jos Posted June 10, 2017 Developers Share Posted June 10, 2017 (edited) It is actually really doing the same thing, but the issue you have encountered here is that AutoIt3 has some extra logic not to process some message while hidden: // If the GUI is hidden then we don't want to trigger any messages because we may be modifying things // via the script when hidden When you use _WinAPI_ShowWindow() for both hiding and showing the window, things will work fine and you won't have this extra logic applied. Jos Edited June 10, 2017 by 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...
Belini Posted June 10, 2017 Author Share Posted June 10, 2017 (edited) Exactly the same I believe that they are not therefore connsigo hide the taskbar using _WinAPI_ShowWindow () and if I use GUISetState () does not work! #include <WinAPI.au3> $hWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") _WinAPI_ShowWindow($hWnd, @SW_HIDE); hiding the taskbar GUISetState(@SW_HIDE, $hWnd); So it does not hide the taskbar Edited June 11, 2017 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Developers Jos Posted June 10, 2017 Developers Share Posted June 10, 2017 My "the same" was in relation to internal created GUI's with the GuiCreate() function with the difference as written in my previous post. I would not use GuiSetState() for any other windows. 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...
Belini Posted June 11, 2017 Author Share Posted June 11, 2017 @Jos you should know the GuiSetState () code and sure enough is right but I'm curious to see the GuiSetState () code to see the extra script that it has in! My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Danyfirex Posted June 11, 2017 Share Posted June 11, 2017 That's my suggestion too. Use GUISetState just for own script windows. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut 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