Jump to content
Sign in to follow this  
Kiti

Click the TrayTip

Recommended Posts

Kiti

Is it possibe to click the traytip and make something happen? Exactly like when you start Windows and a tip appears saying "Your computer might be at risk - Automatic Updates is turned off - Click this balloon to fix this problem." And when you click the baloon the Security Center pops up. Can AutoIt do such thing?

Like:

TraySetOnEvent($TRAY_EVENT_TIPCLICK,"SpecialEvent")

Func SpecialEvent()
    Select
        Case @TRAY_ID = $TRAY_EVENT_TIPCLICK
            ;do something here!!
    EndSelect
EndFunc
Edited by Kiti

Share this post


Link to post
Share on other sites
Kiti
CrewXp

*bumpity bump*

Current Project invokes this method. I've been tinkering with alternative methods, but I'm thinkin to do this, I'm going to have to include an outside library. True?

Share this post


Link to post
Share on other sites
Melba23

CrewXp,

I have done something like this, but I used "Toast" type windows rather then a ToolTip. That way you create the GUI and can easily react when it is clicked. If you are interested I could look up the old code and see if I can get a small example working to show you.

M23


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

Spoiler

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
CrewXp

CrewXp,

I have done something like this, but I used "Toast" type windows rather then a ToolTip. That way you create the GUI and can easily react when it is clicked. If you are interested I could look up the old code and see if I can get a small example working to show you.

M23

Hey Melba. Wow, Perfect! Yea, actually... if I'm thinking of the same 'Toast' that you're thinking of.. I just posted a TOPIC regarding Trillians/Msn's 'Toast' like pop-up they do. That example would be awesome if you can find it! It's exactly what I need to get past this hump in my agenda.

Share this post


Link to post
Share on other sites
Melba23

CrewXp,

I thought you might want it, so I went looking! This example is set up for a taskbar at the bottom of the screen:

#include <WindowsConstants.au3>
#Include <WinAPI.au3>

; Create Toast window
Global $hGUI = GUICreate("", 200, 100, @DesktopWidth - 210, @DesktopHeight - 130, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
Global $hLabel = GUICtrlCreateLabel("Click to close", 1, 1, 198, 198)

; Slide in Toast - but keep focus on current window
_WinAnimate($hGUI, 0x00040008)
$hCurrWnd = _WinAPI_GetForegroundWindow()
GUISetState(@SW_SHOW, $hGUI)
WinActivate($hCurrWnd, "")

; Wait for click from Toast
While 1
    
    Local $aMsg = GUIGetMsg(1)

    If $aMsg[1] = $hGUI And $aMsg[0] = $hLabel Then ExitLoop
    
WEnd

; Slide out window
_WinAnimate($hGUI, 0x00050004)

Exit

; --------------

; Gary Frost's WinAnimate function

Func _WinAnimate($h_gui, $i_mode, $i_duration = 1000)
    
    If @OSVersion = "WIN_XP" OR @OSVersion = "WIN_2000" Or @OSVersion = "WIN_VISTA" Then
        
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $h_gui, "int", $i_duration, "long", $i_mode)
        
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            Return SetError(1, 0, 0)
        EndIf
        Return 1
        
    Else
        
        Return SetError(2, 0, 0)
        
    EndIf
EndFunc;==> _WinAnimate()

Hope it does what you need.

M23


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

Spoiler

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
CrewXp

CrewXp,

I thought you might want it, so I went looking! This example is set up for a taskbar at the bottom of the screen:

#include <WindowsConstants.au3>
#Include <WinAPI.au3>

; Create Toast window
Global $hGUI = GUICreate("", 200, 100, @DesktopWidth - 210, @DesktopHeight - 130, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
Global $hLabel = GUICtrlCreateLabel("Click to close", 1, 1, 198, 198)

; Slide in Toast - but keep focus on current window
_WinAnimate($hGUI, 0x00040008)
$hCurrWnd = _WinAPI_GetForegroundWindow()
GUISetState(@SW_SHOW, $hGUI)
WinActivate($hCurrWnd, "")

; Wait for click from Toast
While 1
    
    Local $aMsg = GUIGetMsg(1)

    If $aMsg[1] = $hGUI And $aMsg[0] = $hLabel Then ExitLoop
    
WEnd

; Slide out window
_WinAnimate($hGUI, 0x00050004)

Exit

; --------------

; Gary Frost's WinAnimate function

Func _WinAnimate($h_gui, $i_mode, $i_duration = 1000)
    
    If @OSVersion = "WIN_XP" OR @OSVersion = "WIN_2000" Or @OSVersion = "WIN_VISTA" Then
        
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $h_gui, "int", $i_duration, "long", $i_mode)
        
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            Return SetError(1, 0, 0)
        EndIf
        Return 1
        
    Else
        
        Return SetError(2, 0, 0)
        
    EndIf
EndFunc;==> _WinAnimate()

Hope it does what you need.

M23

... yes!! omg thanks Melba. I ran the example and well, it worked awesome!! I'll touch it up on the graphics side, but that's EXACTLY what I was looking for! I thought it would be jaggy when it was animating up, but it actually ran very smooth.

Thanks a lot! I'm sure others will find it very handy too. Life Saver!

5am... been working on this for hours, can finally sleep now till my 11am class. So thanks :P

Share this post


Link to post
Share on other sites
Melba23

CrewXp,

If you like the example, go and look at this thread where you will find a much more comprehensive Toast function. No-one seemed interested in it at the time - perhaps you might be now?

M23


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

Spoiler

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.