Function Reference


_WinAPI_ShellNotifyIconGetRect

Gets the screen coordinates of the bounding rectangle of a notification icon

#include <WinAPIShellEx.au3>
_WinAPI_ShellNotifyIconGetRect ( $hWnd, $iID [, $tGUID = 0] )

Parameters

$hWnd Handle to the parent window used by the notification's callback function. For more information,
see the "hWnd" member of the $tagNOTIFYICONDATA structure.
$iID Application-defined identifier of the notification icon. Multiple icons can be associated with a single
$hWnd, each with their own $iID.
$tGUID [optional] $tagGUID structure that identifies the icon.

Return Value

Success: $tagRECT structure that contains the coordinates of the icon.
Failure: Sets the @error flag to non-zero, @extended flag may contain the HRESULT error code.

Remarks

The icon can be identified through $hWnd plus $iID, or $tGUID alone (recommended).

This function requires Windows 7 or later.

See Also

Search Shell_NotifyIconGetRect in MSDN Library.

Example

#include <MsgBoxConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPIShellEx.au3>
#include <WinAPISys.au3>

If Number(_WinAPI_GetVersion()) < 6.1 Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Require Windows 7 or later.')
        Exit
EndIf

Local $tRECT = _WinAPI_ShellNotifyIconGetRect(WinGetHandle(AutoItWinGetTitle()), 1)

Local $aPos
If Not @error Then
        $aPos = _WinAPI_GetPosFromRect($tRECT)
        MouseMove($aPos[0] + 12, $aPos[1] + 12)
        MouseClick('left')
        While 1
                Sleep(1000)
        WEnd
EndIf