Shell_notifyicongetrect ✔ [PLUS]

The Shell_NotifyIconGetRect function is used to retrieve the position and size of a notification icon in the notification area. This information can be useful for positioning other windows or controls in relation to the icon.

While the standard Shell_NotifyIcon function handles adding and modifying icons, it provides no information about where that icon actually sits on the screen. Shell_NotifyIconGetRect fills this gap, allowing applications to: shell_notifyicongetrect

// The main feature logic void DemoShellNotifyIconGetRect() { // 1. Setup a dummy window and icon (Required for the demo) WNDCLASS wc = 0; wc.lpfnWndProc = DefWindowProc; wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = L"TrayDemoClass"; RegisterClass(&wc); The Shell_NotifyIconGetRect function is used to retrieve the

HRESULT Shell_NotifyIconGetRect( [in] const NOTIFYICONIDENTIFIER *identifier, [out] RECT *iconRect ); Shell_NotifyIconGetRect fills this gap

This example creates a temporary invisible window to own the icon, adds an icon to the tray, retrieves its rect using the target API, and draws a highlight rectangle for 3 seconds.

int main() NOTIFYICONDATA nid; RECT rc;