Jump to content

Help on creating a non minimizable GUI in background


Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

I am not 100% following this last part - if you "show" it but it is at the "bottom" then would you want to be able to interact with it?  Perhaps you can explain what you are using this for so I can get a better understanding of what you need.

 

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

Link to comment
Share on other sites

You want it to be on the desktop, but not minimized, but behind all other applications and have buttons?  How would you click the buttons?  

Can you please explain what the code is supposed to do like what is it for?  That may help me better understand.

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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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...