Link to home
Start Free TrialLog in
Avatar of Holger101497
Holger101497

asked on

Minimize app. to "System Tray"/Program Bar Status Area??

All of you know the applications that don't show up in the Launch Bar, but instead only display a little icon at the right edge, e.g. the speaker icon, the printer icon, the dial-up monitor, but also Winfax and ICQ (to name a few "non-system" programs).

Can this be done in Delphi programs?
I tried to find a few hints in the Delphi help, but couldn't find anything useful. There is a reference to the "Taskbar status area", but no hint how to "get there".
Once again - I'd like my application to show up there minimized, but NOT be displayed in the Taskbar.

I guess 100 points are appropriate if there is an "easy" way of doing it. If this is possible but very complicated (maybe some direct WinAPI calls or the like), I'd also pay a lot more as soon as it works - whatever seems to be appropriate. I mostly answer questions (Web areas) and hardly ask any - I have lots of points available...

P.S.: I am using Delphi 3, so that shouldn't be a problem :-)
ASKER CERTIFIED SOLUTION
Avatar of ronit051397
ronit051397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Holger101497
Holger101497

ASKER

Hey! (Almost) cool!!
Everything is easy if you know how to do it ;-)

I got it to work, but have two or three little questions left:
1) Do I need to "register" WndProc? Where? Can this be done in Delphi or do I need another API-call in the onFormCreate? It doesn't work yet.
2) I wanted the application to be "hidden". I did this by setting Visible to false but don't get it to "reappear". Is this the proper way of doing it? What would I do? Set "Visible" in the "onDblClick" and/or in the Popup-Menu?
3) Of course I want to understand what I'm doing! Where do I find the reference for "TNotifyIconData" and the other constants and functions that are used? Anything in the online help? I don't have the printed documentation with me! I'll need to do more complicated things than just place an icon and of course I have to know where to find out more about the parameters I use...

       Thanks a lot!
Oooops! Stupid me! *lol*
well, not so stupid - noticed it myself after all --- I forgot the "override" :-))
I haven't used any API-functions so far :-)
question 1) done
question 2) almost done - is there any (different) standard way of doig this? My program works, though...

only question 3 left...
I added another 25 points for a nice explanation :-))

Q2:
Usually with double click on the tray you should show your screen, but some times you add also an item in the popup menu.

Q3:
This is from shellapi.pas, if you have borland source code, then you can see it there, also look in the Win32.hlp:
....
  TNotifyIconDataA = record
    cbSize: DWORD;
    Wnd: HWND;
    uID: UINT;
    uFlags: UINT;
    uCallbackMessage: UINT;
    hIcon: HICON;
    szTip: array [0..63] of AnsiChar;
  end;

  TNotifyIconDataW = record
    cbSize: DWORD;
    Wnd: HWND;
    uID: UINT;
    uFlags: UINT;
    uCallbackMessage: UINT;
    hIcon: HICON;
    szTip: array [0..63] of WideChar;
  end;

  TNotifyIconData = TNotifyIconDataA;
....
from win32.hlp:

typedef struct _NOTIFYICONDATA { // nid
    DWORD cbSize;          // sizeof(NOTIFYICONDATA)
    HWND hWnd;             // see below
    UINT uID;              // see below
    UINT uFlags;           // see below
    UINT uCallbackMessage; // see below
    HICON hIcon;           // see below
    char szTip[64];        // see below
} NOTIFYICONDATA, *PNOTIFYICONDATA;
 

Contains information that the system needs to process taskbar notification area messages.

hWnd

Handle of the window that receives notification messages associated with an icon in the taskbar notification area.

uID

Application-defined identifier of the taskbar icon.

uFlags

Array of flags that indicate which of the other structure members contain valid data. This member can be a combination of these values:

NIF_ICON      The hIcon member is valid.
NIF_MESSAGE      The uCallbackMessage member is valid.
NIF_TIP      The szTip member is valid.
uCallbackMessage

Application-defined message identifier. The system uses the specified identifier for notification messages that it sends to the window identified by hWnd whenever a mouse event occurs in the bounding rectangle of the icon.

hIcon

Handle of the taskbar icon to add, modify, or delete.

szTip

Tooltip text to display for the taskbar icon.
Well?...
YES! *g*

Sorry for taking such a long time with the grade - I would not have forgot it, though.

The program uses THTTP and I really can't get it to run on any computer but mine (must be some problem with registering ActiveX components and DLL's... ), so I figured I'd grade this answer as soon as everything works. Well, nobody knows how to do it :-(((

"Technically speaking", this question is answered and my other problems are not related to this question at all, so I guess I'll grade it now :-))

Thanks a lot, it all seems to work very nicely and easily :-)