Einzelnen Beitrag anzeigen

Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#9

AW: Remove tray icon when killing program

  Alt 18. Okt 2013, 10:10
Just a few thoughts: you know the ProcessHandle, which is needed for TerminateProcess. To retrieve the corresponding ProcessID you could call OpenProcess. Once you have this ID you could call EnumWindows and within its callback compare your ProcessID to the one of the current window using GetWindowThreadProcessId. If they match, send your Close-Command to that window. I think this should work, but did not try it.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen

Geändert von DeddyH (18. Okt 2013 um 10:32 Uhr) Grund: I confounded ProcessID and ProcessHandle, corrected
  Mit Zitat antworten Zitat