Gets the screen coordinates of the bounding rectangle of a notification icon
#include <WinAPIShellEx.au3>
_WinAPI_ShellNotifyIconGetRect ( $hWnd, $iID [, $tGUID = 0] )
$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. |
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. |
The icon can be identified through $hWnd plus $iID, or $tGUID alone (recommended).
This function requires Windows 7 or later.
Suche nach Shell_NotifyIconGetRect in der MSDN Bibliothek.
#include <MsgBoxConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPIShellEx.au3>
#include <WinAPISys.au3>
If Number(_WinAPI_GetVersion()) < 6.1 Then
MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Fehler', 'Benötigt Windows 7 oder neuer.')
Exit
EndIf
Local $tRECT = _WinAPI_ShellNotifyIconGetRect(WinGetHandle(AutoItWinGetTitle()), 1)
Local $Pos
If Not @error Then
$Pos = _WinAPI_GetPosFromRect($tRECT)
MouseMove($Pos[0] + 12, $Pos[1] + 12)
MouseClick('left')
While 1
Sleep(1000)
WEnd
EndIf