AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Remove tray icon when killing program

Ein Thema von WojTec · begonnen am 17. Okt 2013 · letzter Beitrag vom 25. Jan 2014
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

Remove tray icon when killing program

  Alt 17. Okt 2013, 21:09
Delphi-Version: 2010
I TerminateProcess() another program.
Is possible to remove from tray this program icon (if any)?
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.326 Beiträge
 
Delphi 12 Athens
 
#2

AW: Remove tray icon when killing program

  Alt 17. Okt 2013, 21:37
You can not, because when the program is terminated, it can do nothing more.
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von jaenicke
jaenicke

Registriert seit: 10. Jun 2003
Ort: Berlin
9.869 Beiträge
 
Delphi 12 Athens
 
#3

AW: Remove tray icon when killing program

  Alt 17. Okt 2013, 21:50
There are a few dirty solutions out in the internet, but no really good solution.

The following method works, but I would not recommend it:
Move the mouse cursor over the tray icons, let the mouse click on the button to expand the tray icons, move the mouse over all icons...
If you do this with your programm, all tray icons are clean then, but for the user it is not really a good solution I think.
Sebastian Jänicke
AppCentral
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#4

AW: Remove tray icon when killing program

  Alt 17. Okt 2013, 23:47
If you get shot in your head, will you be able to tell the police afterwards who shot you? Or if a process was able to do something after ist was killed, it could restart it self. Ergo the function TerminateProcess would be needles.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
CCRDude

Registriert seit: 9. Jun 2011
678 Beiträge
 
FreePascal / Lazarus
 
#5

AW: Remove tray icon when killing program

  Alt 18. Okt 2013, 08:03
Injecting code that removes the tray icon would also work, at least as long as you're speaking about a fixed process (you need to find the right handle) and not in general.
  Mit Zitat antworten Zitat
Furtbichler
(Gast)

n/a Beiträge
 
#6

AW: Remove tray icon when killing program

  Alt 18. Okt 2013, 08:24
The following method works, but I would not recommend it:
Why wouldn't you recommend it. It's safe, easy to implement, harmless and robust. What else do you want from a good solution?

BTW: A 'Tray-icon-cleaner' as a separate process would solve the problem. It would run constantly (just another useless process) and cleans the icon area once a second. Don't know if it is possible though, but why not.

No need to use zombies ('shot in the head and go to the police'). This is a job for a 'witness' or a 'sentinel', right?
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.326 Beiträge
 
Delphi 12 Athens
 
#7

AW: Remove tray icon when killing program

  Alt 18. Okt 2013, 09:50
TerminateProcess ist nicht der "normale" Weg, um eine Anwendung zu beenden.
Man könnte natürlich auch versuchen sein Programm so zuverlässig zu schreiben, daß ein derartiger Schritt nicht notwendig ist.
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#8

Re: Remove tray icon when killing program

  Alt 18. Okt 2013, 10:59
Windows don't have any routine to refresh tray, like graphical objects has in Delphi? How it do it when program remove icon themself?

Ok, anyway, I have another idea, but don't know how to code it: send close command and whait let's say 2secs to execute, if not executed then kill it. 1: how to perform close command when only icon in try? 2: How to wait for execution n seconds?
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#9

Re: Remove tray icon when killing program

  Alt 25. Jan 2014, 16:42
So, I found solution, but only partial - doesn't work on V+

madKernel.Process().TrayIcons[].Delete

Author seems to be not interested in fix
  Mit Zitat antworten Zitat
Antwort Antwort

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:05 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz