Solved

Minimize to TNA

Posted on 1998-10-05
1
246 Views
Last Modified: 2010-04-06
Hi,
I write a Program that usually works automatically in the Background of Win32-System. So I think, the Field in the standard Taskbar of Windows 95 etc. does only disturb the User. Now, I'm thinking about to minizime it down to a simple Icon on tha TNA. (Task Notification Area, hoping this is what I mean, the Space where usually the Win32-Clock, the Speaker-Icon and, as the Case maybe, the ICQ-Flower is) I don't know anything about Programming such Application, I wonder if it's possible to minimize the Application from a normal PullDown-Menu. After a Click on the Icon, the Program should automatically maximize itself.

Thanx :)
0
Comment
Question by:omsec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
AndersWP earned 70 total points
ID: 1341798
What you want to do is not particulary difficult. You need to use the Shell_NotifyIcon API function to display an icon in TNA (or System Tray, as I believe the officiel name is).

To hide your application and in stead show an icon in the TNA, do the following:
1. Hide all your forms. This will remove your program from the main task bar.
2. Call Shell_NotifyIcon(NIM_Add,@NotifyIconData), where NotifyIconData is a record of the predefined type TNotifyIconData. This record contains information about the icon you want to show in the TNA. The fields of the record should be set as follows:

    cbSize:=Sizeof(NotifyIconData);
    Wnd:=Handle of window to receive notifications when the TNA icon is clicked
    uID:=Integer ID of your icon. This is just a number you pick.
    uFlags:=NIF_ICON Or NIF_MESSAGE Or NIF_TIP;
    uCallbackMessage:=Message ID of the message you want sent to you when the icon is clicked. Use WM_USER+somenumber less than $4000
    hIcon:=Icon.Handle;  Handle of the icon you want to be shown in the TNA
   szTip: 0-terminated string containing the hint text shown when the mouse cursor is placed on the icon.

After doing this, every time the user clicks the icon, you will receive a message to the form with the handle you passed in NotifyIconData record. The LParam parameter of the message will contain ID of the event that happened to the icon, e.g. WM_LBUTTONDOWN for a left mouseclick.

To remove the icon from the TNA, call  Shell_NotifyIcon(NIM_Delete,@NotifyIconData);

I hope this will help you. If you need it, I can send you some sample code.

Regards,
AndersWP


0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question