Jump to content

Recommended Posts

Posted

Hello friends.

I'm trying to create a gui that remains visible in the background and is not minimizeable/ hideable, but also restorable at all besides of the specified hotkeys.

What I have:

#NoTrayIcon

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

$hParent = GUICreate('', 0, 0, 0, 0, 0, $WS_EX_TOOLWINDOW)
$TestGUI = GUICreate("GUI", @DesktopWidth+10, @DesktopHeight+10, -5, -5, BitOr($WS_SYSMENU, $WS_POPUPWINDOW, $WS_BORDER), $WS_EX_DLGMODALFRAME, $hParent)
GUISetState()

GUISetBkColor(0xABCDEF)

HotKeySet("^+{F4}", "Terminate")
HotKeySet("^+{F5}", "Restore")

While 1
    _WinAPI_SetWindowPos($TestGUI, $HWND_BOTTOM, Default, Default, Default, Default, BitOR($SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOSENDCHANGING))
WEnd

Func Terminate()
    GUISetState(@SW_HIDE, $TestGUI)
EndFunc

Func Restore()
    GUISetState(@SW_SHOW, $TestGUI)
EndFunc

But if I press "Win+D" or the "Show Desktop" button, the GUI disappears until I perform some action - for ex. start an app or open a file...

Thank you in advance!

Posted

How about this?  The GUI is always on top and cannot be minimized.  Hotkeys hide and show it (h for hide and s for show)

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

$TestGUI = GUICreate("TestGui", 405, 293, 302, 218, BitOR($WS_SYSMENU,$WS_CAPTION), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
GUISetState(@SW_SHOW)

HotKeySet("h", "_Hide")
HotKeySet("s", "_Show")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd


Func _Hide()
    
    GUISetState(@SW_HIDE, $TestGUI)
EndFunc

Func _show()
    GUISetState(@SW_SHOW, $TestGUI)
EndFunc

 

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Posted

The gui should akt as a kiosk like desktop frontend with some buttons: so the gui has to stay always behind all other applications, but it shoud be not minimizable by the user and remain in front of the main desktop, ideally also in front of the status bar...

Posted

What's the Problem?

You start an app by pressing a button, to start the next app you have to quit or minimize the previously started app...

Here is the code:

#NoTrayIcon

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GuiButton.au3>

$hParent = GUICreate('', 0, 0, 0, 0, 0, $WS_EX_TOOLWINDOW)
$TestGUI = GUICreate("GUI", @DesktopWidth+10, @DesktopHeight+10, -5, -5, BitOr($WS_SYSMENU, $WS_POPUPWINDOW, $WS_BORDER), $WS_EX_DLGMODALFRAME, $hParent)
GUISetState()

GUISetBkColor(0xABCDEF)

HotKeySet("^+{F4}", "Terminate")
HotKeySet("^+{F5}", "Restore")

$TestBtn = GUICtrlCreateButton("Test",900,500,100,30,-1,-1)
GUICtrlSetOnEvent(-1,"Test")

While 1
    _WinAPI_SetWindowPos($TestGUI, $HWND_BOTTOM, Default, Default, Default, Default, BitOR($SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOSENDCHANGING))

    Switch GUIGetMsg()
        Case $TestBtn
            Test()
    EndSwitch
WEnd

Func Terminate()
    GUISetState(@SW_HIDE, $TestGUI)
EndFunc

Func Restore()
    GUISetState(@SW_SHOW, $TestGUI)
EndFunc

Func Test()
    Run("notepad")
EndFunc

 

Posted

The problem is I was not understanding your description of what you are trying to do.  I wanted more information about what you meant by placing the window beneath all other windows.  But since you are starting to get a bit cagey about what it is or is meant to do I will leave it to others to decide if they want to help out.  

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Posted (edited)

Now I got it.  I was confused by 

Quote

 has to be always on bottom and not on top,

And by this:

Quote

so the gui has to stay always behind all other applications

Edit: have a look at - it might help (not sure if they work on current versions of windows), maybe to disable the windows key: 

 

And this:

 

 

Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

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
×
×
  • Create New...