Jump to content

WinSetOnTop when GUI active


Recommended Posts

How to make function run which one make WinSetOnTop when GUI is active or when user focusing on program (everytime when user interact with program) ?

Im trying with GUIRegisterMSG like here

 

#include <Date.au3>
#include <MsgBoxConstants.au3>
#include <GuiListBox.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>


HotKeySet("{ESC}", "Terminate")



Global $gui = GUICreate("Test", 150, 58,@DesktopWidth-300,@DesktopHeight-58,$WS_POPUP,BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))


Global $idListview = GUICtrlCreateListView("", 0, 0, 150, 58,BitOR($LBS_NOTIFY,$LBS_SORT), 0)
;_GuiCtrlMakeTrans(-1,100)
; Add column
_GUICtrlListView_AddColumn($idListview, "Msgs", 100)

GUICtrlSetFont(-1, 7, 400, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x470C4F)


GUICtrlSetBkColor($idListview, 0x310638)
GUISetState()



While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd



Func Terminate()
    Exit
EndFunc


GUIRegisterMsg ( $WM_ACTIVATE, "makeOnTop" )

Func makeOnTop($hWnd, $iMsg, $iwParam, $ilParam)
    
    WinSetOnTop($msgList, "", $WINDOWS_ONTOP) ; Need to do it becouse it disappears

    Return $GUI_RUNDEFMSG

EndFunc

 

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