Search code examples
nsis

How can I kill System Tray icon application?


I need to stop and kill a system tray icon application in NSIS scriptes ?

KillProcDLL::KillProc "xyz.exe"
KillProcDLL::KillProc "xyz"
nsisDDE::Execute "xyz-{D30034F8-AB97-419F-B3B6-FA5BB8CD926F}" "[Quit]"
nsisDDE::Execute "xyz" "[Quit]"
nsisDDE::Execute "D30034F8-AB97-419F-B3B6-FA5BB8CD926F" "[Quit]"

all above didn't works ?


Solution

  • KillProcDLL in 32-bit NSIS cannot kill a 64-bit process, you must use KillProcWMI.

    Killing a process is not ideal, it is better to use the LockedList plug-in or use FindWindow + SendMessage $window ${WM_CLOSE} 0 0 to gently close the application.

    FindWindow can only be used if the window has a unique window class. Use Spy++ (Visual Studio), WinSpy++ or WinSpyEx to find the window class.