Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TopWindow&PopUp, TrayIcon » Restoring TrayIcon control
Re: Restoring TrayIcon control [message #32099 is a reply to message #32074] Fri, 22 April 2011 09:56 Go to previous messageGo to previous message
lucpolak is currently offline  lucpolak
Messages: 18
Registered: April 2008
Location: France
Promising Member
Up up Smile

I found on the web that restoring the TrayIcon can be made by catching the WM_TASKBARCREATED message.

It can be done by declaring this in the WindowProc fct :

// Somewhere in the code or header ....
UINT WM_TASKBARCREATED = 0 ;


// In the WindowProc
if (message == WM_CREATE)
    WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated");

if (message == WM_TASKBARCREATED)
{
  // Restore the icon ... how can i do it ?
}


I've tried de call TrayIcon::Show() method but it crash with a Shell_NotifyIcon Exception because in the Notify Fonction (TrayIconWin32.cpp) we have this line :

	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(), 125);
		memcpy(nid.tip, stip, len);
		nid.tip[len] = 0;
		VERIFY(Shell_NotifyIcon(msg, (NOTIFYICONDATA *)&nid));


I change this to :

	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(), 125);
		memcpy(nid.tip, stip, len);
		nid.tip[len] = 0;
		while (Shell_NotifyIcon(msg, (NOTIFYICONDATA *)&nid) == FALSE)
		{
			Sleep(100);
		}


but it change nothing ...

Helps please Razz
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to get top and left position of top window
Next Topic: [BUG?] X11 (at least OSX) Menus displayed under TopWindow, owner=RootWindow
Goto Forum:
  


Current Time: Tue Jun 04 20:21:30 CEST 2024

Total time taken to generate the page: 0.01954 seconds