Click here to Skip to main content
14,734,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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;//(HICON)::LoadImage(), MAKEINTRESOURCE(IDI_ICON_INFO), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR | LR_LOADTRANSPARENT);

	// TODO: Add your control notification handler code here
	NOTIFYICONDATA NID;

	memset(&NID, 0, sizeof(NID));

	//on main function:
	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");
	//in a timer:
	
	NID.uFlags = NID.uFlags | NIF_ICON | NIF_TIP ;
	Shell_NotifyIcon(NIM_ADD, &NID);

	//CDialogEx::OnOK();
}

void CTrayIconTestDlg::DisplayNotification()
{
	// TODO: Add your control notification handler code here
	NOTIFYICONDATA NID;
	memset(&NID, 0, sizeof(NID));
	//on main function:
	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");
	//in a timer:
	
	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;
	
	//NID.dwInfoFlags = NID.dwInfoFlags | NIIF_USER;
	//NID.hBalloonIcon = this->m_hIcon;

	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
Posted
Updated 14-Jul-17 6:02am
v4
Comments
KarstenK 5-Aug-16 8:40am
   
I dont get it!!! Even if the icon is already there?
Sounds like a bug by Microsoft. You should contact them and throw away all hope of a fix. (Sorry for that)

1 solution

Hi,

It is not possible to avoid this on Windows 10. You may want to file a bug if you are using one of these products accepting bug reports:

[Microsoft Connect]

Be prepared for your bug to be closed as "By Design".

You can also use the Feedback Hub[^] to submit feedback about this feature.

Best Wishes,
-David Delaune
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900