Please help,about windows system tray

//myclass
class myTIC:public TaskbarIconComponent
{
public:
myTIC()
{
addToDesktop(ComponentPeer::windowAppearsOnTaskbar);
setIconImage(*ImageCache::getFromFile(File(“ico.png”)));
setIconTooltip(String(“myappdemo”));
}
~myTIC()
{
}
void mouseDown(juce::MouseEvent &e)
{
PopupMenu pm;
pm.addItem(101,T(“hello”));
pm.showAt(e.x,e.y);
}
void mouseDoubleClick(juce::MouseEvent &e)
{
AlertWindow::showMessageBox(AlertWindow::InfoIcon,T(“warning”),T(“hi”));
}
};

i add my class to main dialog,but only show ico image and tips,
when i click the sys tray ico,nothing action.
my mousedown and mousedoubleclick function is nothing effect.

why?please help

If you read the comments for the task bar class, it says “don’t attempt to put it on the desktop”!

//addToDesktop(ComponentPeer::windowAppearsOnTaskbar);

delete this lines.
but,yet nothing effect.

please help me.

write a simple demo.thanks.

I assume you’ve checked that your very-dodgy-looking image loading code is actually loading an image, and not returning a null pointer?

i add “myTIC tic;” to my application main dialog class.
then compile app,i run the app.exe,has show icon in sys tray.but i click
the icon no pop the popupmenu,or double click no pop the message box.

can you reply a small source code about system tray.

//---------------------------------------------------
hi,juce,very thanks your juce class,it’s great work,i like juce class. :lol:

Works fine for me. I’ll add this to the juce demo for the next release:

[code]class DemoTaskbarComponent : public TaskbarIconComponent
{
public:
DemoTaskbarComponent()
{
Image icon (Image::RGB, 32, 32, true);
Graphics g (icon);

    g.fillAll (Colours::lightblue);

    g.setColour (Colours::black);
    g.setFont (32.0f, Font::bold);
    g.drawText (T("j"), 0, 0, icon.getWidth(), icon.getHeight(), Justification::centred, false);

    setIconImage (icon);
    setIconTooltip (T("Juce Demo App!"));
}

~DemoTaskbarComponent()
{
}

void mouseDown (const MouseEvent& e)
{
    PopupMenu m;
    m.addItem (1, T("Quit the Juce demo"));

    const int result = m.show();

    if (result == 1)
        JUCEApplication::getInstance()->systemRequestedQuit();
}

};[/code]

juce,thank you very much. very useful :wink:

erm, my name’s not juce… :?

DemoTaskbarComponent dtc;//where write this lines ?

in my application,the tray wintooltips is not display.

i don’t kow why.

i mini the main windows. but in taskbar yet display a button.
i hope hide the button.

i has finished

Sorry, can’t understand what you’re trying to say. I added that code to the juce demo, so it’ll use a tray icon in the next release.