Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Mike Collins
Wed, 12 Mar 2008 14:38
system tray balloon notifcation issue
Author: Mike Collins
Date: Wed, 12 Mar 2008 14:38
Date: Wed, 12 Mar 2008 14:38
48 lines
2900 bytes
2900 bytes
Hi all, I posted the message below to the
microsoft.public.win32.programmer.ui forum but there a bit slack over there
and never want to share an knowledge. Just wondering if anyone here has any
ideas.
// ******************************************************
Just wondering if anyone could help me with a problem / potential bug that
i'm experiencing. I have a system tray application that should run when a
user first logs on. The application displays Balloon Pop-ups to notify the
user of certain events. Within these balloons, I want to display my own
icons instead of using the default NIIF_ icons. Note, this is for use on
Windows XP / 2003.
I have three issues / problems.
Firstly, in the documentation, it states that to set a custom icon in a
balloon you set the dwInfoFlags to NIIF_USER, and then set the hIcon to the
icon in question. However when i do this, the icon changes but not to the
one i specify. For example, if i set it to be my applicaitons icon, i get
the wi-fi icon being displayed. It sees to be the last icon that is shown,
get's displyed in my balloon. I resolved it by setting the uFlah i.e.
uFlags = NIF_INFO | NIF_ICON;
Secondly, when i do this, it causes the system tray icon to change as well.
The only way i can resolve this issue is to immediatly set the system tray
icon back to what it was before the balloon was displayed. This is ok but
it's a bit sloppy.
Finally, when my application first starts up, i still get the wrong icon
being displayed in the balloon.
My code looks like this:
nid.uFlags = NIF_INFO | NIF_ICON;
nid.dwInfoFlags = NIIF_USER;
HICON hIcon = (HICON)::LoadImage(HInstance, MAKEINTRESOURCE(101),
IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
nid.hIcon = hIcon;
bRtn = (bool)Shell_NotifyIcon(NIM_MODIFY, &nid);
::DestroyIcon(hIcon);
Can anyone point me in the write direction here - if there anything obviouse
that i'm doing wrong here.
Many thanks in advance,
Mike C
Re: system tray balloon notifcation issue
Author: Remy Lebeau (TeamB)
Date: Wed, 12 Mar 2008 16:50
Date: Wed, 12 Mar 2008 16:50
37 lines
2030 bytes
2030 bytes
"Mike Collins" <its@TheBottomOfThePost> wrote in message news:47d7e8aa$1@newsgroups.borland.com... > I resolved it by setting the uFlah i.e. > uFlags = NIF_INFO | NIF_ICON; You have to do that anyway. NIF_INFO activates the use of the balloon-related fields, whereas NIF_ICON activates the use of the hIcon field. You can't use hIcon without specifying the NIF_ICON flag. > Secondly, when i do this, it causes the system tray icon to change as > well. Because you are specifying a new icon for it to display. > Finally, when my application first starts up, i still get the wrong > icon being displayed in the balloon. Then you are probably loading the icon wrong to begin with. > My code looks like this: What version of BCB are you using? What value are you setting for the cbSize field? > HICON hIcon = (HICON)::LoadImage(HInstance, > MAKEINTRESOURCE(101), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); How are you including that icon in the project to begin with? > bRtn = (bool)Shell_NotifyIcon(NIM_MODIFY, &nid); Are you using NIM_ADD first? Gambit
Re: system tray balloon notifcation issue
Author: Mike Collins
Date: Mon, 17 Mar 2008 21:16
Date: Mon, 17 Mar 2008 21:16
12 lines
1523 bytes
1523 bytes
Hay Remy, sorry for the late reply - was off work for a few days. In answer to your questions, I'm using BCB 6. I've included my icons in a resource file, added to the application. My code works in every event except when windows first creates the users desktop and loads my application. There after, the icon display in the balloon tips is correct. Initially I create the system tray using another call and it uses nid.cbSize = sizeof(NOTIFYICONDATA); and obviously calls Shell_NotifyIcon with the NIM_ADD.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads