我有一些代码弹出气球提示.它适用于Vista但不适用于Windows XP.到目前为止这是代码.它适用于Vista但不适用于XP.我不明白为什么.此版本不会加载图标,因此它将显示为空白.
memset(&m_notifyData, 0, sizeof(NOTIFYICONDATA)); m_notifyData.cbSize = sizeof(NOTIFYICONDATA); m_notifyData.uFlags = NIF_INFO | NIF_MESSAGE; m_notifyData.hWnd = (HWND) m_preference_window->GetHWND(); m_notifyData.uID = 99; m_notifyData.uTimeout = timeout; m_notifyData.dwInfoFlags = NIIF_NOSOUND | NIIF_INFO; wxStrncpy(m_notifyData.szInfo, message.c_str(), WXSIZEOF(m_notifyData.szInfo)); wxStrncpy(m_notifyData.szInfoTitle, title.c_str(),WXSIZEOF(m_notifyData.szInfoTitle)); Shell_NotifyIcon(NIM_ADD, &m_notifyData); wxLogMessage("Balloon timeout is %i", timeout); m_timer_balloon->Start(timeout, true);
当时间运行时,执行:
Shell_NotifyIcon(NIM_DELETE, &m_notifyData);
任何想法为什么XP不显示消息?
m_notifyData.cbSize = sizeof(NOTIFYICONDATA);
应该
m_notifyData.cbSize = NOTIFYICONDATA_V2_SIZE
Vista在XP提供的基础上添加了几个成员.Size用于指示要传递的结构的版本.XP拒绝它,因为它的大小无法识别.