Update of /cvsroot/pywin32/pywin32/win32/Demos
In directory sc8-pr-cvs1:/tmp/cvs-serv9259
Modified Files:
win32gui_taskbar.py
Log Message:
Re-create the taskbar icons if explorer dies.
Index: win32gui_taskbar.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_taskbar.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** win32gui_taskbar.py 3 Feb 2003 00:30:29 -0000 1.6
--- win32gui_taskbar.py 6 Oct 2003 11:03:15 -0000 1.7
***************
*** 8,12 ****
--- 8,14 ----
class MainWindow:
def __init__(self):
+ msg_TaskbarRestart = RegisterWindowMessage("TaskbarCreated");
message_map = {
+ msg_TaskbarRestart: self.OnRestart,
win32con.WM_DESTROY: self.OnDestroy,
win32con.WM_COMMAND: self.OnCommand,
***************
*** 28,33 ****
0, 0, hinst, None)
UpdateWindow(self.hwnd)
!
# Try and find a custom icon
iconPathName = os.path.abspath(os.path.join( os.path.split(sys.executable)[0], "pyc.ico" ))
if not os.path.isfile(iconPathName):
--- 30,37 ----
0, 0, hinst, None)
UpdateWindow(self.hwnd)
! self._DoCreateIcons()
! def _DoCreateIcons(self):
# Try and find a custom icon
+ hinst = GetModuleHandle(None)
iconPathName = os.path.abspath(os.path.join( os.path.split(sys.executable)[0], "pyc.ico" ))
if not os.path.isfile(iconPathName):
***************
*** 44,47 ****
--- 48,54 ----
nid = (self.hwnd, 0, flags, win32con.WM_USER+20, hicon, "Python Demo")
Shell_NotifyIcon(NIM_ADD, nid)
+
+ def OnRestart(self, hwnd, msg, wparam, lparam):
+ self._DoCreateIcons()
def OnDestroy(self, hwnd, msg, wparam, lparam):
|