Jump to content

GUI help needed


Recommended Posts

I have just started using the GUI capabilities of AutoIt. I want to display the active windows Title and the control with the focus in the active window. I wrote the script below, seems to work ok but in between the update after the sleep func it flashes the title of a different window quickly then back to active window. Seems to work fine when I first start it but after activating different windows this annoyance begins. Also I am unable to close the GUI.

Can someone show me a better way to accomplish this ?

$WS_SYSMENU = 0x00080000

$WS_CAPTION = 0x00C00000

$WS_EX_TOPMOST = 0x00000008

$AppTitle = "Active Window Information"

GUICreate($AppTitle,400,75,500,10,$WS_SYSMENU + $WS_CAPTION,$WS_EX_TOPMOST)

While GUIShow()

$Data = WinGetTitle("") & "|" & ControlGetFocus(WinGetTitle(""))

$list = GUISetControl("list","",1,1,498,73)

GUISetControlData($list,$Data)

Sleep(1000)

Wend

Link to comment
Share on other sites

The close button produces a GuiMsg notification instead of closing the window. You need to do something like the following:

While 1
   sleep(100);do not max-out the CPU
   $msg = GuiMsg(0)
  ;Add more Case statements as needed
   Select
   Case $msg = -3;user clicked the top-right 'x' button
      ExitLoop
   EndSelect
WEnd

Here's shorter way for your specific example:

While GuiMsg(0) <> -3
;do your stuff
WEnd
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...