If you see a shell_notifyicon error, this article may help.
Approved: Fortect
g.As you mentioned earlier, these common errors for Shell_NotifyIcon occur when the main communication with Explorer times out or occurs before Explorer listens. As mentioned in the comments on Shell_NotifyIcon, GetLastError usually returns ERROR_TIMEOUT (legacy error code inherited from internal SendMessageTimeout call) on timeout.
g.
Approved: Fortect
Fortect is the world's most popular and effective PC repair tool. It is trusted by millions of people to keep their systems running fast, smooth, and error-free. With its simple user interface and powerful scanning engine, Fortect quickly finds and fixes a broad range of Windows problems - from system instability and security issues to memory management and performance bottlenecks.
I am writing an application that runs in the background and I want to place an icon in the notification area so that the user can interact with the element from time to time. The app is currently working fine on my development desktop, but I’m also working on a different laptop. Machine too, and I noticed that calling Shell_NotifyIcon with NIM_ADDalways fails and GetLastError returns ERROR_NO_TOKEN 1008:. Windows 7 SP1 works on both machines
However, the problem seems to be related to a good download timeout. My application really crashes when debugging, otherwise the computer will fail Completely idle.
What is the likely cause? By itself cannot find any information about our own error code, at least nothing related to Shell_NotifyIcon. I am following the best practices for each target operating system in terms of the lpdata parameter, most of these values initialized like this:
// NOTICEZeroMemory (& m_nid, sizeof (NOTIFYICONDATA));// Get the Shell32 version number and set the size of this structure.// http://msdn.microsoft.com/en-us/library/bb773352%28v=vs.85%29.aspxULONGLONG version matches GetDllVersion (_T ("Shell32.dll"));if (version> = MAKEDLLVERULL (6,0,6,0))m_nid.cbSize = sizeof (NOTIFYICONDATA);m_nid.uVersion = NOTIFYICON_VERSION_4;otherwise, if (version> = MAKEDLLVERULL (6,0,0,0))m_nid.cbSize = NOTIFYICONDATA_V3_SIZE;m_nid.uVersion = NOTIFYICON_VERSION_4;otherwise, if (MAKEDLLVERULL version (5,0,0,0))M_nid> = .CbSize = NOTIFYICONDATA_V2_SIZE;m_nid.uVersion = NOTIFYICON_VERSION;anotherm_nid.cbSize = NOTIFYICONDATA_V1_SIZE;m_nid.uVersion = 0;m_nid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE | NIF_SHOWTIP;// Only Windows 7 or later systems can use the GUID to identify the notification icon.if (IsWin7OrLater ())= NIF_GUID;m_nid.guidItem = NOTIFICATION_ICON_GUID;anotherm_nid.uID = NOTIFICATION_ICON_ID;// Window for notification about a set of trays:m_nid.hWnd = m_hWnd;m_nid.uCallbackMessage = UM_TRAYNOTIFY;// Define the icon bar and tooltip:m_nid.hIcon corresponds to the App.Tooltip loading icon (idr_mainframe);// displayed if the mouse was always over the symbol. The NIF_TIP flag must be set, but in landscape format.CString = strToolTip _T ("Scheduler");_tcsncpy_s (m_nid.szTip, strToolTip, strToolTip.GetLength ());// If the application was not closed properly properly, the icon may still be present,// but added now invalid hWnd. Remove it before re-adding it.Shell_NotifyIcon (NIM_DELETE, & m_nid);// Add a symbol.bResult = Shell_NotifyIcon (NIM_ADD, & m_nid);DWORD = dw GetLastError ();// Specify the actions of the symbol.bResult = Shell_NotifyIcon (NIM_SETVERSION, & m_nid);
- Edited by Andrew Polden March 27 next year, Tuesday, 12:14 pm. Remove unnecessary code
- Moves Mike Dos Zhang Wednesday, March 28, 03:21 PM Shell API question (from: Common Windows Desktop Development Issues)