Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.625 Beiträge
Delphi 12 Athens
|
AW: Remove tray icon when killing program
18. Okt 2013, 11: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 11:32 Uhr)
Grund: I confounded ProcessID and ProcessHandle, corrected
|