Jump to content

Manage Window


Recommended Posts

Okay this small GUI I'm making is to manage different windows with the same class. I'll be able to hide and show the Window, and rename the Client field on my GUI (not renaming window title). The current things that I need assistance on is: I already got the window title, it is in this format ServerName - CharacterName How do I assign that to a variable but only taking everything after the - and the space preceding? Just "Character Name" of the window title. And then how do I display that variable in the input field. I used GuiCtrlCreatInput since I want the user to be able to change the title for their recognition only, but please advice if I should use another thing to display the window title. Thank you. I got the basic gui below.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Albert Zhen\My Documents\Autoit\GUI\Client Management.kxf
$Form1 = GUICreate("Client Management", 297, 105, 349, 340)
$Input1 = GUICtrlCreateInput("Client 1", 8, 8, 121, 21)
$Input2 = GUICtrlCreateInput("Client 2", 8, 40, 121, 21)
$Input3 = GUICtrlCreateInput("Client 3", 8, 72, 121, 21)
$Hide1 = GUICtrlCreateButton("Hide", 136, 8, 75, 25, $WS_GROUP)
$Show1 = GUICtrlCreateButton("Show", 216, 8, 75, 25, $WS_GROUP)
$Hide2 = GUICtrlCreateButton("Hide", 136, 40, 75, 25, $WS_GROUP)
$Show2 = GUICtrlCreateButton("Show", 216, 40, 75, 25, $WS_GROUP)
$Hide3 = GUICtrlCreateButton("Hide", 136, 72, 75, 25, $WS_GROUP)
$Show3 = GUICtrlCreateButton("Show", 216, 72, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        ;Client 1
        Case $Hide1
            $hwnd1 = WinGetHandle("[class:CLIENT]")
            WinSetState($hwnd1,"",@SW_HIDE)
            $wintitle1 = WinGetTitle($hwnd1)
            ;<<Set the title of window in the input field>>
            
        Case $Show1
            WinSetState($hwnd1,"",@SW_SHOW)
            
        ;Client 2
        Case $Hide2
            $hwnd2 = WinGetHandle("[class:CLIENT]")
            WinSetState($hwnd2,"",@SW_HIDE)
            $wintitle2 = WinGetTitle($hwnd2)
            ;<<Set the title of window in the input field>>
            
        Case $Show2
            WinSetState($hwnd2,"",@SW_SHOW)
            
        ;Client 3
        Case $Hide3
            $hwnd3 = WinGetHandle("[class:CLIENT]")
            WinSetState($hwnd3,"",@SW_HIDE)
            $wintitle3 = WinGetTitle($hwnd3)
            ;<<Set the title of window in the input field>>
            
        Case $Show3
            WinSetState($hwnd3,"",@SW_SHOW)
    EndSwitch
WEnd
Edited by lbrtdy
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...