Sign in to follow this  
Followers 0
bshoenhair

GUI help needed

4 posts in this topic

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

Share this post


Link to post
Share on other sites



I am hoping someone will show me a better way ?

How come I can't close the GUI with the top right close button ?

Help Please

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

CyberSlug

Thanks for pointing out how to close GUI from 'x' button

I fixed my first problem, now it no longer flashes and updates approprately

Share this post


Link to post
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
Sign in to follow this  
Followers 0