Solved

Removing another program's Icon from systray.

Posted on 1999-01-06
7
183 Views
Last Modified: 2010-05-03
How can you remove another application's icon from the systray programatically? shell_notifyicon is no use without knowing the the .uID param of NOTIFYICONDATA struct. I have used Soft Ice to determine that shell_notifyicona actually just invokes SendMessage(shell_trayhwnd, WM_COPYDATA, hwnd source, COPYDATA struct), where the COPYDATA struct must contain info gleaned from the NOTIFYICONDATA struct originally passed to shell_notifyicon. If I could get a handle to the icon, I would just use DestroyIcon... but I can't seem to find a way to get the handle to the icon.
0
Comment
Question by:woodsmj
7 Comments
 
LVL 4

Expert Comment

by:idcanada
ID: 1454317

TerminateProcess API or others should do.
However, you must kill the parent that has set this icon.

The icon in this systray could have been set with a small
form from an application.
You can not remove the form, however, killing the main application, you kill the form.


0
 

Author Comment

by:woodsmj
ID: 1454318
I need to clarify. I do not want to kill the application or process: I simply want to remove its icon from the systray. Ie.- I am writing a replacement front end for dial up networking for a cleitn with expanded functionality and put my own icon in the systray. I do not wish to have Mico$oft's default animated connection icon there while my app is running, but rnaapp.exe still needs to be running, as it exposes the RAS APIs.
0
 
LVL 2

Expert Comment

by:polygon
ID: 1454319
A solution may be: find the handle of the traywindow(findwindow using TrayWnd class), then look for child windows that match you icon (by name). Then just hide the icon, remove it or do whatever you want
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:woodsmj
ID: 1454320
I have enurmerated all child windows and none of them have anything to do with the systray. In fact, the "icon area" of the systray is of class TrayNotify_Wnd and has no children. There must be an HDC or something I can grab for that icon. I have also tried getting a window handle by using the popup menu, but this window handle points to the main app hwnd.
0
 
LVL 3

Accepted Solution

by:
covington earned 600 total points
ID: 1454321
For your specific problem, you can remove the icon for each connection:

Right-click on the connection you wish to change. If you have more than one, you guessed it - repeat these steps for all of them.
In the Connect using section, click on Configure... (This displays a box similar, but not identical to the modem settings in Control Panel.)
Click on the Options tab, and turn off Display modem status in the Status control section.
Click OK, then click OK again.

I've looked into actually removing the icon progromatically, and it's one of the hardest problems I've ever seen.

PS How did you get the handle of the PopUpMenu associated with the icon?
0
 

Author Comment

by:woodsmj
ID: 1454322
Actually... need to do this programmatically, but i'll give you the points anyway so the question doesn't hang around forever...

0
 
LVL 3

Expert Comment

by:covington
ID: 1454323
Thanks for the points...and how did you get that menu handle?
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 48
message box in access 4 46
How to compare ms sql hashbytes results within vb6 5 74
Access Object Property from VBA Module in Excel 2010 2 31
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 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