void TrayIcon::Notify(dword msg) { if(visible) { nid.flags = NIF_ICON|NIF_MESSAGE|NIF_TIP; if(nid.icon) DestroyIcon(nid.icon); nid.icon = IconWin32(icon); String stip = ToSystemCharset(tip); int len = min(stip.GetLength(), 60); memcpy(nid.tip, stip, len); nid.tip[len] = 0; VERIFY(Shell_NotifyIcon(msg, (NOTIFYICONDATA *)&nid)); } } void TrayIcon::Message(int type, const char *title, const char *text, int timeout) { if(!IsWin2K()) return; nid.flags = 0x10; *nid.info = *nid.title = 0; if(text) { String h = ToSystemCharset(text); memcpy(nid.info, h, min(h.GetLength(), 255) + 1); nid.info[255] = 0; } if(title) { String h = ToSystemCharset(title); memcpy(nid.title, h, min(h.GetLength(), 63) + 1); nid.title[63] = 0; } nid.infoflags = type; nid.timeout = minmax(timeout, 10, 30) * 1000; Shell_NotifyIcon(NIM_MODIFY, (NOTIFYICONDATA *)&nid); }