Jump to content
Sign in to follow this  

Output Window

Recommended Posts


I was trying to create an Output window for results for my Script.

It would be nice if it could not get focus of the program that was currently running.

Also it would need to be updated as the values change, not sure if it has to be remade each time or if there is an easy way to update the window with new results.

Share this post

Link to post
Share on other sites

Hi, there's multiple ways to do what your after.

You can set the Extended Styles of the window with $WS_EX_TOPMOST and or$WS_EX_TOOLwindow.

You could also use $WS_EX_MDICHILD and set the window child to another window.

Then use the @SW_SHOWNA or @SW_SHOWNOACTIVATE when you GUISetState() so the window doesn't steal focus when it's initially displayed.

Here's one way

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>

Global $hWnd, $hGui, $Label, $iW = 60, $iH = 20, $Last

$hWnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
$hGui = GUICreate('', $iW, $iH, @DesktopWidth - $iW - 5, -$iH, $WS_POPUP, $WS_EX_MDICHILD, $hWnd)
GUISetBkColor(0x000000, $hGui)
$Label = GUICtrlCreateLabel("", 0, 0, $iW, $iH, BitOR($SS_CENTER, $BS_CENTER))
GUICtrlSetColor(-1, 0xFFFF00)
GUICtrlSetFont(-1, 9, 700)
GUISetState(@SW_SHOWNA, $hGui)

While (Not _IsPressed("1B"))
    If @HOUR & ":" & @MIN  & ":" & @SEC <> $Last Then
        $Last = @HOUR & ":" & @MIN  & ":" & @SEC
        GUICtrlSetData($Label, $Last)
This example is assuming your windows toolbar is at the bottom of the screen.

If your wanting to make it so the gui doesn't steal focus when clicked you could probably use GUIRegisterMsg() to call a function that makes the gui not active when clicked.

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