Tray Icons

This is a discussion on Tray Icons within the Windows Programming forums, part of the Platform Specific Boards category; Hello, i'm trying to find out how to create and tray icon ( without menu's ) i have looked about ...

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

    Tray Icons

    Hello,

    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
    Location
    Banks of the River Styx
    Posts
    902
    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.

    WINSHELLAPI BOOL WINAPI Shell_NotifyIcon(

    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:
    Code:
    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
    Location
    England, Norwich
    Posts
    38
    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
    Location
    Malaysia
    Posts
    970

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, 08: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, 04:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21