Shell_notifyicongetrect
nid.cbSize = sizeof(NOTIFYICONDATA); nid.hwnd = hWnd; // Handle to the window that owns the icon nid.uID = 1; // Identifier of the icon
The guidItem field is optional. For icons added with NOTIFYICONIDENTIFIER_FLAGS.NIIF_USER or similar, you may need it. For classic NIM_ADD via NOTIFYICONDATA , set guidItem = Guid.Empty . shell_notifyicongetrect
[StructLayout(LayoutKind.Sequential)] struct NOTIFYICONIDENTIFIER nid.cbSize = sizeof(NOTIFYICONDATA)
#include <windows.h> #include <shellapi.h> #include <iostream> #include <string> nid.hwnd = hWnd
[DllImport("shell32.dll", CharSet = CharSet.Unicode, PreserveSig = false)] static extern void Shell_NotifyIconGetRect(ref NOTIFYICONIDENTIFIER identifier, out RECT iconRect);
#include <shellapi.h>