Jump to content

How do I make a GUI "un-minimizable"?


Mingre
 Share

Recommended Posts

I'd searched the forum with the strings "unminimizable", "cannot minimize", "gui not minimize" (plus lots of other combinations) but the only relevant thread I found was this:

The last post might have helped the thread starter but unfortunately I don't have any idea how to do what s/he'd instructed:

"You could make a window which has no $WS_SYSMENU and I think that will not minimize for Windows + D." (The thread started hadn't replied either.)

SO is there a way to disable the minimizing of a GUI even when Windows + D is pressed?

Thank you!

Link to comment
Share on other sites

Make it without a minimize button.

I didn't need to look fat in search to find that.

I just added $WS_EX_TOPMOST so it remains when desktop is brought to front.

#include <WinAPIEx.au3> ; www.autoitscript.com/forum/topic/98712-winapiex-udf/
_GUI_NoIcon()
GUICtrlCreateLabel("Example Label", 10, 10, 150, 25)
GUISetState(@SW_SHOW)
While 1
    If GUIGetMsg("Test GUI") = -3 Then
        Exit
    EndIf
WEnd
Func _GUI_NoIcon($sTitle = "", $iWidth = -1, $iHeight = -1, $iXpos = -1, $iYpos = -1)
    Local $hWnd = GUICreate($sTitle, $iWidth, $iHeight, $iXpos, $iYpos, _
            BitOR($WS_CAPTION, $WS_SYSMENU), BitOR($WS_EX_DLGMODALFRAME,$WS_EX_TOPMOST))
    Local $hIcon = _WinAPI_GetClassLongEx($hWnd, $GCL_HICON)
    _WinAPI_DestroyIcon($hIcon)
    _WinAPI_SetClassLongEx($hWnd, $GCL_HICON, 0)
    _WinAPI_SetClassLongEx($hWnd, $GCL_HICONSM, 0)
    Return $hWnd
EndFunc   ;==>_GUI_NoIcon

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Hello John. For some reasons, I can't execute your example. I've already downloaded the UDF. Here's the error log:

C:UsersadminDesktopWinAPIEx_3.5Folders_2.au3(12,30) : WARNING: $WS_CAPTION: possibly used before declaration.

BitOR($WS_CAPTION,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:UsersadminDesktopWinAPIEx_3.5Folders_2.au3(12,43) : WARNING: $WS_SYSMENU: possibly used before declaration.

BitOR($WS_CAPTION, $WS_SYSMENU)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:UsersadminDesktopWinAPIEx_3.5Folders_2.au3(12,72) : WARNING: $WS_EX_DLGMODALFRAME: possibly used before declaration.

BitOR($WS_CAPTION, $WS_SYSMENU), BitOR($WS_EX_DLGMODALFRAME,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:UsersadminDesktopWinAPIEx_3.5Folders_2.au3(12,87) : WARNING: $WS_EX_TOPMOST: possibly used before declaration.

BitOR($WS_CAPTION, $WS_SYSMENU), BitOR($WS_EX_DLGMODALFRAME,$WS_EX_TOPMOST)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:UsersadminDesktopWinAPIEx_3.5Folders_2.au3(13,60) : WARNING: $GCL_HICON: possibly used before declaration.

Local $hIcon = _WinAPI_GetClassLongEx($hWnd, $GCL_HICON)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:UsersadminDesktopWinAPIEx_3.5Folders_2.au3(16,47) : WARNING: $GCL_HICONSM: possibly used before declaration.

_WinAPI_SetClassLongEx($hWnd, $GCL_HICONSM,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:UsersadminDesktopWinAPIEx_3.5Folders_2.au3(12,30) : ERROR: $WS_CAPTION: undeclared global variable.

BitOR($WS_CAPTION,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:UsersadminDesktopWinAPIEx_3.5Folders_2.au3 - 1 error(s), 6 warning(s)

Edited by Lilbert
Link to comment
Share on other sites

Hello again John. I tried your suggestion to use $WS_EX_TOPMOST; it worked---windows + D won't minimize it.

Problem now is, I don't want the GUI to be always on top of the other windows.

Thanks for the quick reply BTW.

Edited by Lilbert
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$styles = BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU )
$hGui = GUICreate("Test", 170, 100, Default, Default, $styles)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Oops I didn't see the Win+d part.You could restore the window automatically after pressing Win+d. Look at WinGetState and WinSetState.

Edited by czardas
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...