We are trying to use Shell_NotifyIcon along with NOTIFYICONDATA structure. On Window 10, We are seeing that if we try to display the balloon notification area along with Title ICON , the ICON gets copied to temp folder everytime it is displayed. It is possible to avoid this ? We have certain use case due to which we do not want any file copy operation triggered while displaying the notifications.
Sample code we tried is as follows:
void CTrayIconTestDlg::AddIconToSysTray()
{
HICON m_hIconInfo = NULL;
NOTIFYICONDATA NID;
memset(&NID, 0, sizeof(NID));
NID.cbSize = sizeof(NID);
NID.hIcon = this->m_hIcon;
NID.hWnd = this->m_hWnd;
NID.uID = WM_USER + 2;
StrCpyW(NID.szTip, L"System Tray Icon: Hello World");
NID.uFlags = NID.uFlags | NIF_ICON | NIF_TIP ;
Shell_NotifyIcon(NIM_ADD, &NID);
}
void CTrayIconTestDlg::DisplayNotification()
{
NOTIFYICONDATA NID;
memset(&NID, 0, sizeof(NID));
NID.cbSize = sizeof(NID);
NID.hIcon = this->m_hIcon;
NID.hWnd = this->m_hWnd;
NID.uID = WM_USER + 2;
StrCpyW(NID.szTip, L"System Tray Icon: Hello World");
NID.uFlags = NID.uFlags | NIF_ICON | NIF_INFO | NIF_TIP ;
StrCpyW(NID.szInfoTitle, L"This is balloon title");
StrCpyW(NID.szInfo, L"This is balloon Information detailed");
NID.uTimeout = 5000;
NID.dwInfoFlags = NID.dwInfoFlags | NIIF_INFO;
BOOL res = Shell_NotifyIcon(NIM_MODIFY, &NID);
if( res == FALSE )
MessageBoxA(NULL, "False", "", MB_OK);
}
What I have tried:
1) MSDN documentation
2) Tried same code on Windows 7, it does not copy the ICON to temp folder