Solved

Minimize to TNA

Posted on 1998-10-05
1
244 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
1 Comment
 
LVL 1

Accepted Solution

by:
AndersWP earned 70 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now