Thread: Tray Icons

  1. #1
    Registered User
    Join Date
    Jan 2006
    England, Norwich

    Tray Icons


    i'm trying to find out how to create and tray icon ( without menu's ) i have looked about the board and havnt found anything thats been able to help. basicl;y i wondering if anyone has an example i could take a look at please not i have also looked up NOTIFYICONDATA on msdn and read everything about it. i do know that you guy don't like people asking for stuff you perfer to give out links to teach people, but in this case i feel as i need somthig to look at that isnt to addvanced and doesnt use classes.

    Thanks Alot

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Banks of the River Styx
    You haven't looked too hard - search this forum for "tray". Did you Google for help?

    Ok, you've read NOTIFYICONDATA - then read the related stuff. What fuctions take a NOTIFYICONDATA structure? Shell_NotifyIcon().
    Quote Originally Posted by TFM
    Sends a message to the system to add, modify, or delete an icon from the taskbar status area.


    DWORD dwMessage, // message identifier
    PNOTIFYICONDATA pnid // pointer to structure
    Doesn't get easier. Two parameters. The first is one of NIM_ADD, NIM_DELETE, or NIM_MODIFY. The other is a NOTIFYICONDATA structure.
    Fill out a NOTIFYICONDATA structure, pass it and NIM_ADD to Shell_NotifyIcon(), and bam! Systray icon. When your program closes, do the same, except with NIM_DELETE.

    Take a stab at it, the worst is that your program gives an error at compile or run time. If it doesn't work, try to find the error, if you can't, post back. People are much more willing to help if you have something to work with. Here's something to start with:
    void MySysTray(HWND hwnd, DWORD action)
      NOTIFYICONDATA nid = {0};
      nid.cbSize = sizeof(NOTIFYICONDATA);
      nid.hWnd = hwnd;
      nid.uID = 1;
      nid.uFlags = NIF_ICON;
      nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);
      Shell_NotifyIcon(action, &nid);
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Registered User
    Join Date
    Jan 2006
    England, Norwich
    OK thank you, at lest i have a start now i'll post back if i have any problems with the code when i'm trying to finsh it.

  4. #4
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows task tray icons
    By xixpsychoxix in forum Windows Programming
    Replies: 8
    Last Post: 05-24-2008, 03:14 AM
  2. GTK+ Gnome desktop system tray app problem
    By BobS0327 in forum Linux Programming
    Replies: 2
    Last Post: 04-01-2006, 09:54 PM
  3. Problems with audio functions, tray icons + more!
    By face_master in forum Windows Programming
    Replies: 0
    Last Post: 10-08-2002, 10:35 PM
  4. system tray icons
    By canine in forum Windows Programming
    Replies: 1
    Last Post: 05-14-2002, 03:51 PM
  5. System Tray Icons
    By ExDigit in forum Windows Programming
    Replies: 5
    Last Post: 01-08-2002, 05:26 PM