Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8.2, 0.8.3, and 0.9

stable thgtaskbar: catch pywintypes.error during explorer startup

Fixes #453

Changeset 5430a10d5698

Parent 0ff451ceba9c

by Steve Borho

Changes to one file · Browse files at 5430a10d5698 Showing diff from parent 0ff451ceba9c Diff from another changeset...

Change 1 of 2 Show Entire File thgtaskbar.py Stacked
 
60
61
62
63
 
64
65
66
 
115
116
117
118
119
120
 
 
 
 
 
 
121
122
123
 
60
61
62
 
63
64
65
66
 
115
116
117
 
 
 
118
119
120
121
122
123
124
125
126
@@ -60,7 +60,7 @@
  action = NIM_ADD   try:   Shell_NotifyIcon(action, nid) - except: + except pywintypes.error:   # This is common when windows is starting, and this code is hit   # before the taskbar has been created.   print "Failed to add the taskbar icon - is explorer running?" @@ -115,9 +115,12 @@
  AppendMenu(menu, win32con.MF_STRING, EXIT_CMD, 'Exit' )   pos = GetCursorPos()   # See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp - SetForegroundWindow(self.hwnd) - TrackPopupMenu(menu, win32con.TPM_LEFTALIGN, pos[0], pos[1], 0, self.hwnd, None) - PostMessage(self.hwnd, win32con.WM_NULL, 0, 0) + try: + SetForegroundWindow(self.hwnd) + TrackPopupMenu(menu, win32con.TPM_LEFTALIGN, pos[0], pos[1], 0, self.hwnd, None) + PostMessage(self.hwnd, win32con.WM_NULL, 0, 0) + except pywintypes.error: + pass   return 1     def OnCommand(self, hwnd, msg, wparam, lparam):