UDF > WinAPIEx > ShellEx >


_WinAPI_ShellNotifyIconGetRect

Obtient les coordonnées d'écran du rectangle de délimitation de l'icône de notification

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

Paramètres

$hWnd Handle de la fenêtre parent utilisé par la fonction de rappel de la notification. Pour plus d'informations, voir le membre "hWnd" de la structure $tagNOTIFYICONDATA.
$iID L'identifiant défini par l'application de l'icône de notification. De multiples icônes peuvent être associées à un seul $hWnd, chacune avec leur propre $iID.
$tGUID [optionnel] La structure $tagGUID qui identifie l'icône.

Valeur de retour

Succès: Retourne la structure $tagRECT qui contient les coordonnées de l'icône.
Échec: Définit @error <> 0, @extended peut contenir le code d'erreur HRESULT.

Remarques

L'icône peut être identifié par $hWnd plus $iID, ou $tGUID seul (recommandé).

Cette fonction nécessite Windows 7 ou une version ultérieure.

Voir aussi

Consultez Shell_NotifyIconGetRect dans la librairie MSDN.

Exemple

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

If Number(_WinAPI_GetVersion()) < 6.1 Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Erreur', 'Nécessite Windows 7 ou une version ultérieure.')
    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