Commits

Adrian Buehlmann  committed 372443a

thgtaskbar: implement terminate command

Partial packport of ff0cede782a4 from default branch

Allows to terminate the thgtaskbar.exe with the new
terminate.exe from the default branch.

Potential use case: 0.10 installer might terminate
thgtaskbar.exe of 0.9.2 by using terminate.exe.

  • Participants
  • Parent commits 1f32196
  • Branches stable

Comments (0)

Files changed (1)

File thgtaskbar.py

 
     def OnDestroy(self, hwnd, msg, wparam, lparam):
         nid = (self.hwnd, 0)
-        Shell_NotifyIcon(NIM_DELETE, nid)
+        try:
+            Shell_NotifyIcon(NIM_DELETE, nid)
+        except pywintypes.error:
+            pass # happens when we run without icon
         PostQuitMessage(0) # Terminate the app.
 
     def OnTaskbarNotify(self, hwnd, msg, wparam, lparam):
 
 class PipeServer:
     def __init__(self, hwnd):
+        self.hwnd = hwnd
         self.updater = Updater(hwnd)
         self.updater.start()
 
 
                 try:
                     requests.put(data)
+                    if data == 'terminate|':
+                        print 'PipeServer received terminate from pipe'
+                        print 'posting EXIT_CMD to gui thread...'
+                        PostMessage(self.hwnd, win32con.WM_COMMAND, EXIT_CMD, 0)
+                        break
                 except SystemExit:
                     raise SystemExit # interrupted by thread2.terminate()
                 except: