Jump to content

Hide an "always on top Gui if another prog Maximiz


Recommended Posts

:lmao: Having trouble figuring out how to Hide my created Gui("Search Mode") when another application is opened and maximized on top of the previous one(Hoster-demo.exe, in this case)

The idea is to modify Hoster-Demo's "Add Track Database Search" window, with the Gui eventually(havent written the event handlers yet) selecting between "Normal" and "Mini". The problem is when I open another application like Windows Media Player, or BpmStudio and maximize them, I can't figure out how to Hide the "Search Mode" box I created(it would be preferable to have it hide when any window opens maximized over Hoster. Right now it hides when Hoster minimizes, and the whole script exits when Hoster exits.

BTW...I'm fairly new at this, but I love the ease of use that AutoIT/SCiTe provides(The Help files ROCK!!)

heres what i have so far:

#NoTrayIcon
opt ("WinTitleMatchMode", 2); sets Window title matching to "any substring"(For Hosters Main Window-depending on which playlist is current)
#region;Open hoster and clear the demo dialog, then maximize.
;delete .hst file so playlist is blank(creates a new one when adding songs)
FileDelete('C:\Program Files\Micro Technology Unlimited\Hoster Demo\Playlists\def001.hst')
Sleep(3000)
Run('C:\Program Files\Micro Technology Unlimited\Hoster Demo\Hoster-demo.exe')
Sleep(2000)
WinActivate("Dialog")
ControlClick("Dialog", "Demo", 1)
WinSetState(" - Hoster", "", @SW_MAXIMIZE)
#endregion
ReconfigureSearchwindow (); Opens and transforms search window to half its size
WinActivate(" - Hoster")
#region; Search Mode Box(always on top)
;Unless Hoster is minimized, or another program covers Hoster
;Closes with Hoster
#include "GUIConstants.au3"
Opt ("GUIOnEventMode", 1); Change to OnEvent mode
GUICreate("Search Mode", 155, 120, 620, 0, $WS_EX_TOOLWINDOW)
WinSetOnTop("Search Mode", "", 1); Search mode window on top.
GUICtrlCreateButton("Normal", 7, 5, 135, 30)
GUICtrlCreateButton("Mini", 7, 40, 135, 40)
GUICtrlSetFont(3, 14, 400)
GUICtrlSetFont(4, 14, 400)
GUISetState()
While 1
   Dim $Hosterwindowstate = WinGetState(" - Hoster", "")
   Select
      Case BitAND($Hosterwindowstate, 16)
         HideSearchwindow();minimized
      Case BitAND($Hosterwindowstate, 2)
         ShowSearchwindow();visible
      Case Not WinExists(" - Hoster", "")
         Exit; Hoster has closed, close search window.
   EndSelect
WEnd
Func ShowSearchwindow()
   WinSetState("Search Mode", "", @SW_SHOW)
EndFunc  ;==>ShowSearchwindow 
Func HideSearchwindow()
   WinSetState("Search Mode", "", @SW_HIDE)
EndFunc  ;==>HideSearchwindow 

#endregion

Here's the code for "ReconfigureSearchwindow ()" :

#NoTrayIcon
Func ReconfigureSearchwindow()
   #region; Open Search dialog
   opt ("WinTitleMatchMode", 2); sets Window title matching to "any substring"(For Hosters Main Window-depending on which playlist is current)
   ControlClick(" - Hoster", "Search", 1032)

   WinWaitActive("Add Track Database Search")
   WinSetState("Add Track Database Search", "", @SW_HIDE); Hide window before moving items
   WinMove("Add Track Database Search", "", 473, 286, 278, 300); Resizes window to rh-lower corner(with room for Vscrollbar)
   #endregion
   #region; Rearrange/resize: Search-txtbx,Searchbtns, & Results-listview
   ControlMove("Add Track Database Search", "", 1141, 5, 70, 235, 100);search listview
   ControlMove("Add Track Database Search", "", 1135, 49, 5, 190, 23);search text
   ControlMove("Add Track Database Search", "", 1146, 15, 35, 50, 23);BookID Button
   ControlMove("Add Track Database Search", "", 1142, 95, 35, 50, 23);Song Button
   ControlMove("Add Track Database Search", "", 1143, 175, 35, 50, 23);Artist Button
   ControlMove("Add Track Database Search", "", 65535, 2, 10, 47, 13);Textbox label
   ControlSetText("Add Track Database Search", "", 65535, "Search >");reset textbox label
   #endregion
   #region; Rearrange/resize Keychange buttons
   ControlMove("Add Track Database Search", "", 1026, 245, 4);"-5" keychange button
   ControlMove("Add Track Database Search", "", 1027, 245, 28);"-4" keychange button
   ControlMove("Add Track Database Search", "", 1028, 245, 52);"-3" keychange button
   ControlMove("Add Track Database Search", "", 1029, 245, 76);"-2" keychange button
   ControlMove("Add Track Database Search", "", 1030, 245, 100);"-1" keychange button
   ControlMove("Add Track Database Search", "", 1031, 245, 124);"-0" keychange button
   ControlMove("Add Track Database Search", "", 1032, 245, 148);"+1" keychange button
   ControlMove("Add Track Database Search", "", 1033, 245, 172);"+2" keychange button
   ControlMove("Add Track Database Search", "", 1034, 245, 196);"+3" keychange button
   ControlMove("Add Track Database Search", "", 1035, 245, 220);"+4" keychange button
   ControlMove("Add Track Database Search", "", 1036, 245, 244);"+5" keychange button
   ControlHide("Add Track Database Search", "", "Set key:");"Set key:" label
   #endregion
   #region; Rearrange/resize: Language, Genre, Duet, & Mux(currently set to hide all)
   ControlHide("Add Track Database Search", "", "Language:");"Language:" label
   ControlHide("Add Track Database Search", "", "Genre:");"Genre:" label
   ControlHide("Add Track Database Search", "", "Duet:");"Duet:" label
   ControlHide("Add Track Database Search", "", 1163);Duet Display
   ControlHide("Add Track Database Search", "", "Mux:");"Mux:" label
   ControlHide("Add Track Database Search", "", 1165);"Mux:" Display
   ControlHide("Add Track Database Search", "", 1170);Genre Display
   ControlHide("Add Track Database Search", "", 1166); Language Display
   ControlMove("Add Track Database Search", "", 1145, 2, 175); Song Selected label
   ControlMove("Add Track Database Search", "", 1144, 2, 190); Song Selected Display label
   #endregion
   #region; Rearrange/resize: Singers-txtbx, and Add track/Close buttons
   ControlMove("Add Track Database Search", "", "Singers:", 80, 235, 75, 14); Singers label
   ControlSetText("Add Track Database Search", "", "Singers:", "^  Singer(s) ^"); reset Singers label
   ControlMove("Add Track Database Search", "", 1124, 2, 210, 230, 24); SingersTxtbox
   ControlMove("Add Track Database Search", "", 1133, 2, 237, 72, 28); Add Track button
   ControlMove("Add Track Database Search", "", 2, 160, 237, 72, 28); Close button
   WinSetState("Add Track Database Search", "", @SW_SHOW); Show window After moving items
   #endregion
EndFunc  ;==>Searchwindowreconfigure

Anyhow I posted Bmp's of the screenshots from the above on my other post concerning GUICTRLCREATE

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
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...