Tech Support > Microsoft Windows > Development Resources > show/hide taskbar icons.
show/hide taskbar icons.
Posted by B on May 6th, 2006


I have a win32 application that shows an icon in the taskbar/system
tray with a few context menus on it..The application can be started
from the start menu [ the installation puts links there ] or from the
command line.

The menus include "hide from taskbar" and "exit". A "hide" is expected
to hide the icon from the taskbar leaving the application running.

I have managed to hide the icon on saying "hide". How do I get back the
icon on the taskbar on clicking the start menu link. [ which inturn
would fire up the application ] ?

This is how my code looks:-

int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR
lpCmdLine,int nCmdShow)
{

//instantiates the class for managing the icon which does register
class, create window-etc.
//and eventually shows the icon in the tray.

//does a few other things here

while((bRet = GetMessage(&msg,NULL,0,0)) != 0)
{
if(bRet == -1)
{

//return error.
retVal = ERROR;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

if(retVal != ERROR)
return (int)msg.wParam;
else
return retVal;

}



Thanks in advance,
-B.

Posted by Steve on May 12th, 2006


B wrote:
A system tray icon or the taskbar button?

This code only seems to show a message loop.


Similar Posts