This NEW SystemTray utilities include enables you to insert or remove an icon(from a file) onto the system-tray,
pop-up a windows notification BalloonTip box from an existing SysTray Icon, or without one.
(For those that dont know, the System-Tray is all the little icons down the bottom right of the desktop by the clock)

"SysTrayIcon_create" lets you create a persistant SysTray Icon, with the Icon of your choice, IF you choose.

"SysTrayIcon_remove" lets you remove a previously created SysTray Icon.

"BalloonTip_attach" lets you pop-up a message from a previously created SysTray Icon, with a "self-clear" timeout.

"BalloonTip_create" lets you pop-up a message from a dummy SysTray Icon, with a "self-clear" timeout that clears the Icon too.

All the documentation is included in the code-block below, including a tester "main.c" to test it with.
All you will need is an ICO file from somewhere for the tester code.

As usual, if the embedded instructions are unclear, or you find a bug, or you have any suggestions,
just let me know!

Thanks all. Any feedback on success/failure is appreciated.

NOTE: my previous Code can still be found at the bottom of this post...

SysTray.H
Code:
#ifndef	systray_h
#define	systray_h
////
//
//////////////////////////////////////////////////////////////////////////////////////////
//																						//
//	File :	SysTray.h																	//
//	Author:	EvilSOB 																	//
//	Date:	1/July/2009																	//
//																						//
//	Requirements:	windows.h					(and acknex.h or litec.h of course)		//
//																						//
//																						//
//======================================================================================//
//	USAGE Description																	//
//======================================================================================//
//																						//
//	SysTrayIcon_create( Icon_Desc, Icon_Name);											//
//																						//
//---------------------------------------------------------------------------------------/
//		Adds the Icon from file "Icon_Name" from the project folder to the SystemTray.	//
//		This SystemTrayIcon will remain present until SysTrayIcon_remove is called.		//
//																						//
//		IMPORTANT: If application closes before SysTrayIcon_remove is called, then the	//
//		Icon will remain displayed indefinately, until the mouse is next over the icon.	//
//																						//
//---------------------------------------------------------------------------------------/
//		Parameters:																		//
//			char*	Icon_Desc = The tooltip-text to display when mouse hovers over icon.//
//			char*	Icon_Name = Filename of the "windows-format" .ICO file to use.		//
//																						//
//---------------------------------------------------------------------------------------/
//		Returns:	A pointer to the intrinsic SysTrayIcon(NOTIFYICONDATA) structure.	//
//																						//
//																						//
//																						//
//																						//
//======================================================================================//
//																						//
//	SysTrayIcon_remove( SysTrayIcon_pointer );											//
//																						//
//---------------------------------------------------------------------------------------/
//		Immediately removes the SystemTray Icon created by the SysTrayIcon structure 	//
//		by the SysTrayIcon_pointer parameter, and releases all resources, and the 		//
//		structure memory too.															//
//																						//
//		IMPORTANT: Must be called for all application-created SysTrayIcons otherwise	//
//		they will remain displayed indefinately, until the mouse moves over the icons.	//
//																						//
//---------------------------------------------------------------------------------------/
//		Parameters:																		//
//			SysTrayIcon	= The pointer to the SystrayIcon structure to be removed.		//
//																						//
//																						//
//																						//
//																						//
//======================================================================================//
//																						//
//	BalloonTip_attach( SysTrayIcon, Message, Title, Icon_type, Timeout );				//
//																						//
//---------------------------------------------------------------------------------------/
//		This function pops up a notification "BalloonTip" attached to the SystemTrayIcon//
//		pointed to by "SysTrayIcon". If "SysTrayIcon" is NULL then nothing will happen.	//
//		The Balloon will remove itself at the end of the "Timeout" period.				//
//		NOTE: If any BalloonTip is already being displayed, THIS onE will not be shown.	//
//																						//
//		IMPORTANT: If application closes before timeout expires, then the BalloonTip	//
//		remain displayed indefinately, until the mouse moves over the icons.			//
//																						//
//---------------------------------------------------------------------------------------/
//	Parameters:																			//
//				SysTrayIcon	= The pointer to the SystrayIcon structure to be attach to.	//
//		char*	Message	  	= The text to display in the "body" of the balloon.			//
//		char*   Title	  	= The text to display in the "heading" of the balloon.		//
//		var		Icon_type 	= Ballon-Icon display flags.  (see Notes#1)					//
//																						//
//																						//
//																						//
//																						//
//======================================================================================//
//																						//
//	BalloonTip_create(Message, Title, Icon_Text, Icon_Type, Icon_Name, Timeout);		//
//																						//
//---------------------------------------------------------------------------------------/
//		Adds the Icon from file "Icon_Name" from the project folder to the SystemTray.	//
//		Then pops up a notification "BallonTip" attached to that system tray icon.		//
//		Balloontip with close on mouseclick, or it can be ignored until the 			//
//		system-tray icon removes itself at the end of the "Timeout" period.				//
//		NOTE: If any BalloonTip is already being displayed, THIS onE will not be shown.	//
//																						//
//		IMPORTANT: If application closes before timeout expires, then the icon and 		//
//		balloon will remain displayed indefinately, until mouse moves over the icon.	//
//																						//
//---------------------------------------------------------------------------------------/
//		Parameters:																		//
//			char*	Message	  = The text to display in the "body" of the balloon.		//
//			char*   Title	  = The text to display in the "heading" of the balloon.	//
//			char*	Icon_Text = The tooltip-text to display when mouse hovers over icon.//
//			var		Icon_Type = Ballon-Icon display flags.  (see Notes#1)				//
//			char*	Icon_Name = Filename of the "windows-format" .ICO file to use.		//
//			var 	Timeout	  = Timeout period in seconds.								//
//																						//
//																						//
//																						//
//																						//
//======================================================================================//
//======================================================================================//
//																						//
//	NOTES #1	ICON TYPE AND ICON MODIFIER FLAGS										//
//--------------------------------------------------------------------------------------//
//	Flags are passed in normal 3DGS fashion. eg ( PM_INVERTED | PM_TOP2BOTTOM )			//
//		STI_NONE		-	(default)Display NO icon IN the top-left of the balloon.	//
//		STI_INFO		-	Display an Information icon.								//
//		STI_WARNING		-	Display a  Warning icon.									//
//		STI_ERROR		-	Display an Error icon.										//
//		STI_USER_ICON	-	Use the SysTrayIcon Icon-image.								//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
//		Modifier flags																	//
//		BTI_Mod_NOSOUND		-	Pre-Vista - Do not play the associated sound.			//
//		BTI_Mod_LARGE_ICON	-	Vista     - Show Ballon with Large Icon.(untested)		//
//																						//
//======================================================================================//
//======================================================================================//
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//	ANY CHANGES MADE FROM HERE ON IN ARE AT YOUR OWN RISK !  PROCEED WITH CAUTION !		//
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//Ballon-Icon Type
#define STI_NONE			0x0000	//Display NO icon IN the top-left of the balloon.
#define STI_INFO			0x0001	//Display an Information icon.
#define STI_WARNING			0x0002	//Display a  Warning icon.
#define STI_ERROR			0x0003	//Display an Error icon.
#define STI_USER_ICON		0x0004	//Use the SysTrayIcon Icon-image.
//Modifiers
#define BTI_Mod_NOSOUND		0x0010	//Pre-Vista = Do not play the associated sound.
#define BTI_Mod_LARGE_ICON	0x0010	//Vista     = Show Ballon with Large Icon.(untested)
//
// API-Usage only flags.
//
#define NIM_ADD			0x00
#define NIM_MODIFY		0x01
#define NIM_DELETE		0x02
//
#define NIF_MESSAGE		0x001
#define NIF_ICON		0x002
#define NIF_TIP			0x004
#define	NIF_INFO		0x010
//
#define	IMAGE_ICON		0x0001
#define	LR_FROMFILE		0x00010
#define	LR_VGACOLOR		0x00080
#define	LR_SHARED		0x08000
//
//
//
#ifndef	windows_h
	#include <windows.h>	//include WINDOWS.H in not already loaded
#endif	//windows_h
//
//
typedef struct NOTIFYICONDATA
{	DWORD	cbSize;
	HWND	hWnd;
	UINT	uID;
	UINT	uFlags;
	UINT	uCallbackMessage;
	long	hIcon;
	char	szTip[128];
	DWORD	dwState;
	DWORD	dwStateMask;
	char	szInfo[256];
	UINT	uTimeout;
	char	szInfoTitle[64];
	DWORD	dwInfoFlags;
}NOTIFYICONDATA;
//
BOOL __stdcall Shell_NotifyIcon(DWORD dwMessage, NOTIFYICONDATA* lpData);
//
#define SysTrayIcon		NOTIFYICONDATA
//
var STI_IdGen=0;
//
//
//
//
//
//////////////////////////////////////////////////////////////
//		SysTrayIcon_create Function							//
//////////////////////////////////////////////////////////////
//
//
SysTrayIcon* SysTrayIcon_create(char* i_desc,char* i_name)
{
	SysTrayIcon* _nid = malloc(sizeof(SysTrayIcon));	
	memset(_nid,0,sizeof(SysTrayIcon));
	_nid.cbSize = sizeof(SysTrayIcon);  
	_nid.hWnd = hWnd;	
	_nid.uID  = STI_IdGen++;	
	_nid.uFlags = NIF_ICON|NIF_TIP; 
	strcpy(_nid.szTip, ""); 		if(i_desc)	strcpy(_nid.szTip, 		 i_desc); 
	_nid.hIcon = LoadImage(0,i_name,IMAGE_ICON,16,16,LR_FROMFILE|LR_VGACOLOR|LR_SHARED);
	_nid.dwInfoFlags = STI_NONE;
	Shell_NotifyIcon(NIM_ADD, _nid); 
	return(_nid);
}
//
//
//////////////////////////////////////////////////////////////
//		SysTrayIcon_remove Function							//
//////////////////////////////////////////////////////////////
//
//
function SysTrayIcon_remove(SysTrayIcon* _nid)
{
	if(!_nid)	return(false);		//remove ABORTED. _NID does not exist
	DeleteObject(_nid.hIcon);
	if(Shell_NotifyIcon(NIM_DELETE,_nid))	return(true);	//removed SUCCESSFULLY
	return(false);		//remove FAILED.
}
//
//
//////////////////////////////////////////////////////////////
//		BalloonTip_attach Function							//
//////////////////////////////////////////////////////////////
//
//
void BalloonTip_attach(SysTrayIcon* _nid, char* msg, char* tit, var i_type, var t_out)
{
	_nid.uFlags = NIF_ICON|NIF_TIP|NIF_INFO; 
	_nid.dwInfoFlags = i_type;
	strcpy(_nid.szInfoTitle, "");	if(tit)		strcpy(_nid.szInfoTitle, tit);
	strcpy(_nid.szInfo, "");		if(msg)		strcpy(_nid.szInfo, 	 msg);
	Shell_NotifyIcon(NIM_MODIFY, _nid); 
	wait(-t_out);
	_nid.uFlags = NIF_ICON|NIF_TIP; 
	_nid.dwInfoFlags = STI_NONE;
	_nid.szInfoTitle = _nid.szInfo = NULL;
	Shell_NotifyIcon(NIM_DELETE, _nid); 
	Shell_NotifyIcon(NIM_ADD, _nid); 
}
//
//
//////////////////////////////////////////////////////////////
//		BalloonTip_create Function							//
//////////////////////////////////////////////////////////////
//
//
void BalloonTip_create(char* msg,char* tit,char* i_desc,var i_type,char* i_name,var t_out)
{
	SysTrayIcon* _nid = SysTrayIcon_create(i_desc, i_name);
	BalloonTip_attach(_nid, msg, tit, i_type, t_out);
	wait(-t_out);
	SysTrayIcon_remove(_nid);
}
//
//
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//
////
#endif	//systray_h









/*		TESTER "MAIN.C" FILE
//////////////////////////////////////////////////////////////////////////////////////////

#include <acknex.h>
#include <default.c>
#include "SysTray.h"

int main()
{
	video_window(nullvector,nullvector,112,"System Tray Icon Example");
	mouse_pointer = 2;		vec_fill(screen_color,128);
	//
	BalloonTip_create("message","title","app_name",STI_ERROR,"icon.ico",30);
	//
	wait(-10);		//delay "second" tray icon so you can close the first ballon.
	beep();	
	SysTrayIcon* temp = SysTrayIcon_create("Test Icon", "iconA.ico");
	wait(-5);
	beep();
	BalloonTip_attach(temp, "Body Text", "Title Text", STI_WARNING, 5);
	wait(-5);
	beep();
	wait(-5);
	beep();
	SysTrayIcon_remove(temp);
	//
	wait(-5);		//wait until "expected" finish time of first sys-icon...
	beep();
}

//////////////////////////////////////////////////////////////////////////////////////////
*/
//



For the Retro-Buffs out there, here is my OLD preliminary "BalloonTips" include.
Click to reveal..

This include enables you to insert an icon(from a file) onto the system-tray, and pop-up a message box.
(For those that dont know, the system tray is all the little icons down the bottom right of the desktop by the clock)

"ShowBalloonTip" lets you create an icon, pop-up a message, and have it clear itself after a set amount of time.

"AttachBalloonTip" latst you pop-up a message from an already existing system-tray icon you created elsewhere.

All the documentation if included in the code-block below, including a tester "main.c" to test it with.
All you will need is an ICO file from somewhere.

As usual, if the enbedded instructions are unclear, or you find a bug, or you have any suggestions,
just let me know!

Thanks all. Any feedback on success/failure is appreciated.

BalloonTips.H
Code:
#ifndef	balloontips_h
#define	balloontips_h
////
//
//////////////////////////////////////////////////////////////////////////////////////////
//																						//
//	File :	BalloonTips.h																//
//	Author:	EvilSOB - With help from MMike												//
//	Date:	30/6/2009																	//
//																						//
//	Requirements:	windows.h					(and acknex.h or litec.h of course)		//
//																						//
//																						//
//======================================================================================//
//	USAGE Description																	//
//======================================================================================//
//																						//
//	ShowBalloonTip(Message, Title, Icon_text, Icon_type, Icon_name, Timeout);			//
//																						//
//---------------------------------------------------------------------------------------/
//		Adds the Icon from file "icon_name" from the project folder to the SystemTray.	//
//		Then pops up a notification "BallonTip" attached to that system tray icon.		//
//		Balloontip with close on mouseclick, or it can be ignored until the 			//
//		system-tray icon removes itself at the end of the "Timeout" period.				//
//																						//
//		IMPORTANT: If application closes before timeout expires, then the icon and 		//
//		balloon will remain displayed indefinately, until mouse moves over the icon.	//
//																						//
//---------------------------------------------------------------------------------------/
//		Parameters:																		//
//			char*	Message	  = The text to display in the "body" of the balloon.		//
//			char*   Title	  = The text to display in the "heading" of the balloon.	//
//			char*	Icon_Text = The tooltip-text to display when mouse hovers over icon.//
//			var		Icon_type = Ballon-Icon display flags.  (see Notes#1)				//
//			char*	Icon_name = Filename of the "windows-format" .ICO file to use.		//
//			var 	Timeout	  = Timeout period in seconds.								//
//																						//
//																						//
//																						//
//																						//
//======================================================================================//
//																						//
//	AttachBalloonTip(NOTIFYICONDATA* _nid, char* Message, char* Title, var Icon_type);	//
//																						//
//---------------------------------------------------------------------------------------/
//		If the NOTIFYICONDATA object named "_nid" is already in use for a 				//
//		ShellNotifyIcon then the Ballon message will appear attached to that icon.		//
//																						//
//		But, if the NOTIFYICONDATA object named "_nid" is NOT in use 					//
//		(ie _nid.uID = NULL), then the function AttachBalloonTip will 					//
//		return WITHOUT generating any Balloons or errors.								//
//																						//
//---------------------------------------------------------------------------------------/
//		Parameters:																		//
//			char*	Message	  = The text to display in the "body" of the balloon.		//
//			char*   Title	  = The text to display in the "heading" of the balloon.	//
//			var		Icon_type = Ballon-Icon display flags.  (see Notes#1)				//
//																						//
//																						//
//																						//
//////////////////////////////////////////////////////////////////////////////////////////
//																						//
//	...																					//
//	ShowBalloonTip("Message text", "Title text", "icon text", 5);						//
//	or																					//
//	ShowBalloonTip(Message_string.chars, Title_string.chars, IconText_string.chars, 5);	//
//	...																					//
//																						//
//////////////////////////////////////////////////////////////////////////////////////////
//																						//
// BalloonTip Icon Types																//
//////////////////////////////////////////////////////////////////////////////////////////
//																						//
//																						//
//Ballon-Icon Type																		//
#define BTIcon_NONE			0x0000	//No icon.											//
#define BTIcon_INFO			0x0001	//An information icon.								//
#define BTIcon_WARNING		0x0002	//A warning icon.									//
#define BTIcon_ERROR		0x0003	//An error icon.									//
#define BTIcon_USER_ICON	0x0004	//Use the Systray Icon.								//
//Modifiers																				//
#define BTI_Mod_NOSOUND		0x0010	//Pre-Vista = Do not play the associated sound.		//
#define BTI_Mod_LARGE_ICON	0x0010	//Vista     = Show Ballon with Large Icon.(untested)//
//																						//
//																						//
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//																						//
// API-Usage only flags.																//
//																						//
#define NIM_ADD			0x00															//
#define NIM_MODIFY		0x01															//
#define NIM_DELETE		0x02															//
//																						//
#define NIF_MESSAGE		0x001															//
#define NIF_ICON		0x002															//
#define NIF_TIP			0x004															//
#define	NIF_INFO		0x010															//
//																						//
#define	IMAGE_ICON		0x0001															//
#define	LR_FROMFILE		0x00010															//
#define	LR_VGACOLOR		0x00080															//
#define	LR_SHARED		0x08000															//
//																						//
//																						//
//////////////////////////////////////////////////////////////////////////////////////////
//																						//
#ifndef	windows_h																		//
	#include <windows.h>	//include WINDOWS.H in not already loaded					//
#endif	//windows_h																		//
//																						//
//////////////////////////////////////////////////////////////////////////////////////////
//																						//
typedef struct NOTIFYICONDATA															//
{	DWORD	cbSize;																		//
	HWND	hWnd;																		//
	UINT	uID;																		//
	UINT	uFlags;																		//
	UINT	uCallbackMessage;															//
	long	hIcon;																		//
	char	szTip[128];																	//
	DWORD	dwState;																	//
	DWORD	dwStateMask;																//
	char	szInfo[256];																//
	UINT	uTimeout;																	//
	char	szInfoTitle[64];															//
	DWORD	dwInfoFlags;																//
}NOTIFYICONDATA;																		//
//																						//
BOOL __stdcall Shell_NotifyIcon(DWORD dwMessage, NOTIFYICONDATA* lpData);				//
//																						//
//																						//
//////////////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////
//		ShowBalloonTip Function															//
//////////////////////////////////////////////////////////////////////////////////////////
//
//
void ShowBalloonTip(char* msg,char* tit,char* i_desc,var i_type,char* i_name,var timeout)
{
	NOTIFYICONDATA _nid;	zero(_nid);
	_nid.cbSize = sizeof(NOTIFYICONDATA);  
	_nid.hWnd = hWnd;	
	_nid.uID  = 1;	
	_nid.uFlags = NIF_ICON|NIF_TIP|NIF_INFO; 
	strcpy(_nid.szInfo, "");		if(msg)		strcpy(_nid.szInfo, 	 msg);
	strcpy(_nid.szInfoTitle, "");	if(tit)		strcpy(_nid.szInfoTitle, tit);
	strcpy(_nid.szTip, ""); 		if(i_desc)	strcpy(_nid.szTip, 		 i_desc); 
	_nid.hIcon = LoadImage(0,i_name,IMAGE_ICON,16,16,LR_FROMFILE|LR_VGACOLOR|LR_SHARED);
	if(!_nid.hIcon)		_nid.dwInfoFlags = BTIcon_NONE;	   //if custom icon fails to load
	else				_nid.dwInfoFlags = i_type;
	Shell_NotifyIcon(NIM_ADD, _nid); 
	// Fake Timeout Functionality...
	wait(-timeout);
	Shell_NotifyIcon(NIM_DELETE, _nid);
	DeleteObject(_nid.hIcon);
}
//
//
//////////////////////////////////////////////////////////////////////////////////////////
//		AttachBalloonTip Function														//
//////////////////////////////////////////////////////////////////////////////////////////
//
//
void AttachBalloonTip(NOTIFYICONDATA* _nid, char* msg, char* tit, var i_type)
{
	if(!_nid)	return;		//no existing window. Abort
	_nid.uFlags = ( NIF_ICON | NIF_TIP | NIF_INFO ); 
	_nid.dwInfoFlags = i_type;
	strcpy(_nid.szInfo, "");		if(msg)		strcpy(_nid.szInfo, 	 msg);
	strcpy(_nid.szInfoTitle, "");	if(tit)		strcpy(_nid.szInfoTitle, tit);
	Shell_NotifyIcon(NIM_MODIFY, _nid); 
}
//
//
//////////////////////////////////////////////////////////////////////////////////////////
//
////
#endif	//balloontips_h









/*		TESTER "MAIN.C" FILE
//////////////////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#include "BalloonTips.h"


int main()
{
	video_window(nullvector,nullvector,112,"System Tray Icon Example");
	mouse_pointer = 2;		vec_fill(screen_color,128);


	ShowBalloonTip("You've opened a Balloon Tip Box for TEN seconds", "BTIcon_WARNING type BalloonTip", "Game-Name", BTIcon_WARNING, "iconA.ico", 10);
	
}
//////////////////////////////////////////////////////////////////////////////////////////
*/



Last edited by EvilSOB; 07/01/09 05:37. Reason: MAJOR Overhaul...

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial