Mingre Posted May 8, 2012 Share Posted May 8, 2012 (edited) Hello AutoIt Forums,I'm trying to make a GUI similar to those of Windows 7 gadgets, RocketDock and whatnots in which the GUI doesn't disappear when Win + D is pressed.I had previously started (ages ago) a thread dealing with the same problem < http://autoitscript.com/forum/topic/134945-how-do-i-make-a-gui-un-minimizable/ > though I think it was inappropriately titled because the GUI window isn't exactly minimized when Win + D is pressed, i.e., it just hides behind the desktop (i.e., BitAnd(16, Wingetstate($GUI) yields 0). The only way I know of which can prevent the GUI from hiding is to toggle on the "Always on Top" atttribute of the GUI but I don't want to do just that.Here's what I did: (I didn't accomplish anything close to what I'd like to do)#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> $hide = GUICreate('') $show = GUICreate("Test GUI", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_BORDER, $WS_POPUP, $WS_SYSMENU), -1, $hide) GUISetState(@SW_SHOW, $show) Opt("GUIOnEventMode",1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") While 1 Sleep(1000) Local $state = WinGetState($show, "") If BitAND($state, 16) Then WinSetState($show, '', @SW_RESTORE) ; <<< doesn't restore the GUI when Win + D is pressed. ToolTip(@SEC & @CRLF & _ 'Exists =' & BitAND($state, 1) & @CRLF & _ 'Visible =' & BitAND($state, 2) & @CRLF & _ 'Enabled =' & BitAND($state, 4) & @CRLF & _ 'Active =' & BitAND($state, 8) & @CRLF & _ 'minimized =' & BitAND($state, 16) & @CRLF & _ 'Maximized =' & BitAND($state, 32), 0, 0) WEnd Func _exit() Exit EndFunc ;==>_ExitHelp please? Thanks.Edit: Fixed thread link.Edit 2: Thread title - added [sOLVED]. Thanks funkey! Edited May 11, 2012 by Lilbert Link to comment Share on other sites More sharing options...
funkey Posted May 9, 2012 Share Posted May 9, 2012 (edited) It took me quite long to find this solution! I hope this is what you want! #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> Global $hDesktop = ControlGetHandle("[CLASS:Progman]", "", "SysListView321") Global $hGui = GUICreate("Non Minimizable", 500, 500, -1, -1, $WS_MAXIMIZEBOX) _WinAPI_SetWindowLong($hGui, $GWL_HWNDPARENT, $hDesktop) GUISetState() Do Until GUIGetMsg() = -3 Edited May 9, 2012 by funkey Mingre and JScript 2 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
guinness Posted May 9, 2012 Share Posted May 9, 2012 Nice find funkey. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
TheNorwegianUser Posted May 10, 2012 Share Posted May 10, 2012 Why not just do something simple, like this?: #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") GUICreate("Example", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) GUICtrlSetBkColor(-1, 0xFF0000) GUISetState(@SW_SHOW) While 1 If Not WinActive("Example") Then WinActivate("Example") EndIf Wend Func Terminate() Exit EndFunc Press ESC to exit. Link to comment Share on other sites More sharing options...
guinness Posted May 10, 2012 Share Posted May 10, 2012 Why not just do something simple, like this?If you change the width and height then funkey's approach is better. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Mingre Posted May 11, 2012 Author Share Posted May 11, 2012 Why not just do something simple, like this?: #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") GUICreate("Example", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) GUICtrlSetBkColor(-1, 0xFF0000) GUISetState(@SW_SHOW) While 1 If Not WinActive("Example") Then WinActivate("Example") EndIf Wend Func Terminate() Exit EndFunc Press ESC to exit. But I don't like my GUI to be always above the other windows. It took me quite long to find this solution! I hope this is what you want! #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> Global $hDesktop = ControlGetHandle("[CLASS:Progman]", "", "SysListView321") Global $hGui = GUICreate("Non Minimizable", 500, 500, -1, -1, $WS_MAXIMIZEBOX) _WinAPI_SetWindowLong($hGui, $GWL_HWNDPARENT, $hDesktop) GUISetState() Do Until GUIGetMsg() = -3 Brilliant. Thanks funkey! Link to comment Share on other sites More sharing options...
Nick86 Posted February 21, 2017 Share Posted February 21, 2017 On 09.05.2012 at 1:42 PM, funkey said: It took me quite long to find this solution! I hope this is what you want! #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> Global $hDesktop = ControlGetHandle("[CLASS:Progman]", "", "SysListView321") Global $hGui = GUICreate("Non Minimizable", 500, 500, -1, -1, $WS_MAXIMIZEBOX) _WinAPI_SetWindowLong($hGui, $GWL_HWNDPARENT, $hDesktop) GUISetState() Do Until GUIGetMsg() = -3 Win 10, this does not work. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 21, 2017 Moderators Share Posted February 21, 2017 Seeing as the post is almost 5 years old, that is not surprising. In the future, please do not resurrect old posts; I am sure there are plenty of scripts out there for XP that no longer work too, but we don't need to know about every one. If you are encountering an issue, please start a new thread and (as the OP in this thread intelligently did) post a link to the previous thread for background if necessary. "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
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