xAlimorAx Posted November 22, 2009 Share Posted November 22, 2009 I read around in the FAQ's and some OLD Posts, but i could only find half answers in most of the posts and nothing in the FAQ. I need an idea on how to get my GUI to stay on top of all windows... Here is my code expandcollapse popup#NoTrayIcon ; Prompt the user to run the script - use a Yes/No prompt (4 - see help file) $answer = MsgBox(4, "Verification For DCS2 Anti-Idle", "Run DCS2 Anti-Idle V3?") ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $answer = 7 Then Exit EndIf HotKeySet("^!x", "MyExit") #include <GUIConstantsEx.au3> #include <GuiConstants.au3> #include <Constants.au3> Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) ;Opt('MustDeclareVars', 1) Opt("GUICoordMode", 2) TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"SpecialEvent") ;TraySetState(2) ; hide --> not needed dcsgui() Func dcsgui() Local $Button_1, $Button_2, $msg GUICreate("DCS2 Anti-Idle", "340", "75") $Button_1 = GUICtrlCreateButton("Start Anti-Idle", 10, 30, 100) $Button_2 = GUICtrlCreateButton("Stop Anti-Idle", 10, -1, 100) $Button_3 = GUICtrlCreateButton("End Anti-Idle", 10, -1) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ProcessClose("Anti-Idle(Do Not Run).exe") Exit Case $msg = $GUI_EVENT_MINIMIZE GuiSetState(@SW_HIDE) TraySetState(1) ; show TraySetToolTip ("DCS2 Anti-Idle V3 - click here to restore") Case $msg = $Button_1 GUICtrlSetState($Button_1, $GUI_DISABLE) If Not WinExists("[CLASS:Second Life]") Then MsgBox(0, "Error", "Please make sure you have Second Life or Emerald Viewer open before starting the program!") Exit EndIf ControlFocus("[CLASS:Second Life]", "", "") WinWait("[CLASS:Second Life]") Run("Anti-Idle(Do Not Run).exe", "") Case $msg = $Button_2 ProcessClose("Anti-Idle(Do Not Run).exe") GUICtrlSetState($Button_1, $GUI_ENABLE) Case $msg = $Button_3 ProcessClose("Anti-Idle(Do Not Run).exe") Exit EndSelect WEnd EndFunc Func SpecialEvent() GuiSetState(@SW_Show) TraySetState(2) ; hide EndFunc Func MyExit() ProcessClose("Anti-Idle(Do Not Run).exe") Exit EndFunc Thanks in advance! Link to comment Share on other sites More sharing options...
Appie78 Posted November 22, 2009 Share Posted November 22, 2009 Hi xAlimorAx, Put this line under your GUICreate, it works for me! WinSetOnTop("DCS2 Anti-Idle","",1) Have fun Arnaud Electron microscopes rule!!! Link to comment Share on other sites More sharing options...
xAlimorAx Posted November 22, 2009 Author Share Posted November 22, 2009 Nice knocked out 2 problems with one... I was using GUICreate("DCS2 Anti-Idle V3", "340", "40", "20", "50", BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) But that killed my minimize button... So thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now