Update of /cvsroot/pywin32/pywin32/win32/Demos
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29667/win32/Demos
Modified Files:
win32gui_taskbar.py
Log Message:
Update demo to handle that the taskbar may not be created (either due to
windows still starting up, or explorer dieing)
Index: win32gui_taskbar.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_taskbar.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** win32gui_taskbar.py 6 Oct 2003 11:03:15 -0000 1.7
--- win32gui_taskbar.py 10 Jan 2006 00:30:00 -0000 1.8
***************
*** 47,51 ****
flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
nid = (self.hwnd, 0, flags, win32con.WM_USER+20, hicon, "Python Demo")
! Shell_NotifyIcon(NIM_ADD, nid)
def OnRestart(self, hwnd, msg, wparam, lparam):
--- 47,58 ----
flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
nid = (self.hwnd, 0, flags, win32con.WM_USER+20, hicon, "Python Demo")
! try:
! Shell_NotifyIcon(NIM_ADD, nid)
! except 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?"
! # but keep running anyway - when explorer starts, we get the
! # TaskbarCreated message.
def OnRestart(self, hwnd, msg, wparam, lparam):
|