Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Minimize to TNA

Posted on 1998-10-05
1
Medium Priority
?
253 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 140 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month12 days, 20 hours left to enroll

972 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