Sign in to follow this  
Followers 0

task bar gui

5 posts in this topic


I want to create a 'search bar' that is embedded into the taskbar. When a user enters something into the taskbar then presses enter, an ini file is searched. Does anybody know if this is possible? If not, is it possible to run a gui (with input box) from a single left click of the tray icon?

I already the have the script funcioning - however it is by clicking on the tray icon and then selecting a tray icon menu, there is no need for multiple button clicks.

If either of these are possible, does anybody know how!?


Share this post

Link to post
Share on other sites


I found this lying around - seems pretty close to the option you say you will accept, although you still have some work to do: :oops:

#include <GUIConstantsEx.au3>
#include <Constants.au3>
#Include <GuiToolBar.au3>

Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu
Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown.

TrayItemSetOnEvent(-1, "On_About")
TrayItemSetOnEvent(-1, "On_Exit")



; Set left click to act as Play/Pause or New
TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "On_Dialog")

; Set tray icon tool tip
$sToolTipText = "My Dialog"

Global $iIcon_X, $iIcon_Y

; Find the tray icon

; Create and hide the GUI
GUICreate("My Dialog", 200, 200, $iIcon_X - 200, $iIcon_Y - 240)

While 1

    Switch GUIGetMsg()
        ; Pressing either [_] or [X] rehides the GUI


Func On_Dialog()

    ; Show the GUI


Func _Locate_Icon   ()

    ; Find taskbar
    Local $aPos = WinGetPos("[Class:Shell_TrayWnd]", "")
    ; Start icon position calculation
    $iIcon_X = $aPos[0]
    $iIcon_Y = $aPos[1]
    ; Get systray handle and position
    Local $hSysTray_Handle = ControlGetHandle("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:1]")
    $aPos = ControlGetPos("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:1]")
    If @error Then Return
    ; Continue icon position calculation
    $iIcon_X += $aPos[0]
    $iIcon_Y += $aPos[1]
    ; Get systray item count
    Local $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
    If $iSysTray_ButCount = 0 Then Return
    ; Look for tooltip by finding track title
    For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
        Local $sText = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber)
        If StringInStr($sText, $sToolTipText) > 0 Then
            ; Get coords of icon
            $aPos = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSysTray_ButtonNumber)
            ; Finalise icon position calculation
            $iIcon_X += $aPos[0]
            $iIcon_Y += $aPos[1]
        If $iSysTray_ButtonNumber = $iSysTray_ButCount - 1 Then Return 1

    Return 0


Func On_About()
    MsgBox(0, "About", "Whatever")

Func On_Exit()

No idea about the first idea though, sorry. :D


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

#3 ·  Posted (edited)

Make the GUI an Always on Top Window without any window border or window controls. It won't be embedded into the Taskbar but it will look like it. Also, make sure to give it the tool window extended style so that an unneeded program won't appear in the list or Alt-Tab. This will accomplish what you are attempting. If you need help with what I recommended it can be found in the Autoit documentation. Also an example script will be available upon request.


Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post

Link to post
Share on other sites


Thanks for that. I now have it working to show the GUI on a left click and exit on the right click.


I did toy with that idea but thought it would turn into a nightmare logistically - calculating how far into the taskbar from the right the existing system tray icons come in; then and from the left open programs that show there, what if there are so many open programs they are hidden under the gui etc. Unfortuantely I think these are insurmountable problems which is why it would need to be embedded :D


Share this post

Link to post
Share on other sites

3mustgetbeers, here's another attempt to work on:

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

Global $hSearch

_SearchGUI(200, 27)

Func _SearchGUI($iW, $iH)
Local $hGui, $hExit, $hSrc, $hDum
$hGui = GUICreate("Select drives", $iW, $iH, @DesktopWidth - $iW, @DesktopHeight - $iH - 30, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))

$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW - 22, 5, 16, 16, BitOR($SS_NOTIFY, $WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1, 0)

$hSrc = GUICtrlCreateIcon("shell32.dll", -23, $iW - 42, 5, 16, 16, BitOR($SS_NOTIFY, $WS_GROUP))
GUICtrlSetTip(-1, "Start searching!...")
GUICtrlSetCursor(-1, 0)

$hDum = GUICtrlCreateButton("a", $iW, $iH, -1, -1, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))

$hSearch = GUICtrlCreateInput("Search...", 5, 5, $iW - 52, $iH - 10, BitOR($GUI_SS_DEFAULT_INPUT, $WS_BORDER), 0)
GUICtrlSetColor(-1, 0xDEDEDE)
GUICtrlSetBkColor(-1, 0x222222)
GUICtrlCreatePic("", 1, 1, $iW - 2, $iH - 2, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui, "", 200)


While 1
Switch GUIGetMsg()
Case $hExit
Case $hSrc, $hDum
MsgBox(32, "Found...", 'Here goes your search code for "' & GUICtrlRead($hSearch) & '"')
EndFunc ;==>_SearchGUI

Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode, $hWndSearch
If Not IsHWnd($hSearch) Then $hWndSearch = GUICtrlGetHandle($hSearch)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF)
$iCode = BitShift($iwParam, 16)
Switch $hWndFrom
Case $hSearch, $hWndSearch
Switch $iCode
ConsoleWrite('changed to "' & GUICtrlRead($hSearch) & '"' & @CRLF) ;just for testing
;if nothing was entered, set to default text
If GUICtrlRead($hSearch) = "" Then GUICtrlSetData($hSearch, "Search...")
ConsoleWrite("lost focus" & @CRLF) ;just for testing
;if focused, delete the default text
If GUICtrlRead($hSearch) = "Search..." Then GUICtrlSetData($hSearch, "")
ConsoleWrite("got focus" & @CRLF) ;just for testing
EndFunc ;==>_WM_COMMAND

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