Jump to content

GUI under start menu, on top of everything else


theholycow
 Share

Recommended Posts

As the title says, I want to have my gui run on top of everything, but still be able to access the taskbar and start menu. doable?

Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad...

Link to comment
Share on other sites

Hi,

I'd imagine youd have to write some form of custom function using GUIRegisterMsg(), WinActive, _WinAPI_GetWindowLong, _WinAPI_SetWindowLong, _WinAPI_SetWindowPos to set the window topmost and not topmost depending on the state of your window.

I could be wrong, but I don't think there is a magic set once window style that will accomplish what you need.

Cheers

Link to comment
Share on other sites

I was afraid of that... hmm ok. I am almost certainly not capable enough to do that right, so I'll try to find another way to make it work

Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad...

Link to comment
Share on other sites

I was afraid of that... hmm ok. I am almost certainly not capable enough to do that right, so I'll try to find another way to make it work

It's not that difficult. You only need to use WinSetOnTop.

When you use WinSetOnTop for your gui it sets it to the top of course. If you then use WInSetOnTop again but forthe task bar then your gui will be second from the top and will not cover the task bar.

Here is a small example

#include <guiconstantsex.au3>
#include <Timers.au3>
$GUI = GUICreate("Window ", 300, 300, 300, 300)
GUISetState()
$WPos = WinGetPos($GUI)

WinSetOnTop($GUI, "", 1)
WinSetOnTop("[class:Shell_TrayWnd]", "", 1)
$topped = True

While 1
    If WinActive($GUI) And Not $topped Then
        WinSetOnTop("[class:Shell_TrayWnd]", "", 1)
        $topped = True
    Else
        $topped = False
    EndIf

    $m = GUIGetMsg()
    Switch $m
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    
WEnd

That has the disadvatage that if your gui is not active and then you drag it over the task bar it won't go behind the task bar until you let go of it. This can be solved by using a timer.

#include <guiconstantsex.au3>
#include <Timers.au3>
$GUI = GUICreate("Window ", 300, 300, 300, 300)
GUISetState()
$WPos = WinGetPos($GUI)

WinSetOnTop($GUI, "", 1)
WinSetOnTop("[class:Shell_TrayWnd]", "", 1)
$topped = True
_Timer_SetTimer($Gui,40,"topsy")
While 1
    

    $m = GUIGetMsg()
    Switch $m
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    
WEnd

Func Topsy($a,$b,$c,$d)
    If WinActive($GUI) And Not $topped Then
        WinSetOnTop("[class:Shell_TrayWnd]", "", 1)
        $topped = True
    Else
        $topped = False
    EndIf
    
EndFunc
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Haha, and I just spent the last two hours trying to figure out how to do exactly that. I couldn't figure out how to specify the taskbar... thanks

Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad...

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