Solved

Minimize to TNA

Posted on 1998-10-05
1
247 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 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