Jump to content
Sign in to follow this  
Hyflex

Unsure how to create a GUI as described in post...

Recommended Posts

Hyflex

Hi Guys,

I'm unsure how to create a GUI for how I want/close to how I want it...

Basically, I want an easily accessible GUI window that can minimize to a small box/bar on the side of the screen instead of minimising to taskbar. 

I also want to keep the window on top (using: WinOnTop), but if possible never in focus even when clicked on (if this is possible) because I want it so if I click a button on the autoit window it would mouseclick/type or whatever on the last active window...
 

Any ideas or examples someone could provide to assist me with this?

Share this post


Link to post
Share on other sites
Realm

Hello Hyflex

Take a look at the function WinMove(). You can move and resize windows with this function.

Realm

Edit:

Also Look at GUIGetMsg(). for customizing the actions of all your window messages.

Also Look at WinGetHandle("[Active]"). It will return the handle to the current window/app in use. Use this to monitor the current active window and use to return to from your custom script.

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites
Tekk

#include <GUIConstants.au3>

Global Const $SC_MINIMIZE = 0xF020
Global Const $SC_MOVE = 0xF010

Global Const $tagRECT = "struct; long Left;long Top;long Right;long Bottom; endstruct"

Global $aiOldPos[4]
Global $bMinimized = False

Global $hGUI = GUICreate("My GUI", 800, 600, -1, -1, -1, $WS_EX_NOACTIVATE + $WS_EX_TOPMOST)
Global $idButton = GUICtrlCreateButton("Flash Active", 20, 20, 75, 20)

GUISetState(@SW_SHOWNOACTIVATE)

GUIRegisterMsg($WM_MOVING, "WM_MOVING")
GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")


While 1
    Switch GUIGetMsg()
        Case $idButton
            WinFlash(WinGetHandle("[ACTIVE]"), null, 10, 50)

        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $lParam

    If ($bMinimized And (BitAND($wParam, 0xFFF0) = $SC_MOVE)) Then Return False

    Switch $wParam
        Case $SC_MINIMIZE
            If (Not $bMinimized) Then
                $aiOldPos = WinGetPos($hWnd)
                WinMove($hWnd, Null, 5, @DesktopHeight / 2 - 300 / 2, 175, 300)
            Else
                WinMove($hWnd, Null, $aiOldPos[0], $aiOldPos[1], $aiOldPos[2], $aiOldPos[3])
            EndIf

            $bMinimized = Not $bMinimized

            Return False
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc

Func WM_MOVING($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $wParam

    Local $tRECT = DllStructCreate($tagRECT, $lParam)

    WinMove($hWnd, Null, DllStructGetData($tRECT, "Left"), DllStructGetData($tRECT, "Top"))
EndFunc

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  

×