void ShowNotificationData(bool on) { NOTIFYICONDATA nid; ZeroMemory(&nid, sizeof(nid)); const CPath * imagePath = on ? config.GetOnIconPath() : config.GetOffIconPath(); UINT flags = LR_MONOCHROME; flags |= LR_LOADFROMFILE; HICON icon = (HICON)LoadImage( NULL, *imagePath, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), flags); nid.hIcon = icon; nid.uID = niData.uID; nid.hWnd = niData.hWnd; nid.uFlags = NIF_ICON; Shell_NotifyIcon(NIM_MODIFY, &nid); DestroyIcon(icon); }