Minimizing app to system tray with Win32
slippnslide

Could anyone provide me with a link or an example of a Win32 application that you can minimize to the system tray? Everything I've found requires MFC or it's for Visual Studio 2003 and it doesn't seem to work in Visual Studio 2005. Also, it needs to be in either C or C++.

Thanks in advance for any replies.

Archon

Look in MSDN.

_Dante

Specifically, look up Shell_NotifyIcon().

A J
1NOTIFYICONDATA nid;
2nid.cbSize = sizeof(NOTIFYICONDATA);
3nid.hWnd = win_get_window();
4nid.uID = 0;
5nid.uFlags = NIF_ICON | NIF_TIP;
6nid.uCallbackMessage = 0;
7char tmp[256];
8get_executable_name(tmp, 256);
9HMODULE hMod = GetModuleHandle(tmp);
10if ( NULL == hMod )
11 log << "failed to GetModuleHandle() ";
12else
13{
14 HICON hIco = LoadIcon( hMod, "ALLEGRO_ICON");
15 if ( NULL == hIco )
16 log << "failed to LoadIcon()";
17 else
18 {
19 nid.hIcon = hIco;
20 strncpy( nid.szTip, "Your app Name", 64 );
21 if ( false == Shell_NotifyIcon( NIM_ADD, &nid ))
22 log << "failed to Shell_NotifyIcon()";
23 }
24}

slippnslide

Great, thanks A J. Hopefully between a few Win32 tutorials I finally found and what you gave me, this will work.

Thread #586328. Printed from Allegro.cc