[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.123,1.124

Mark Hammond mhammond at users.sourceforge.net
Sun Dec 21 22:16:31 EST 2003


Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv11813

Modified Files:
	addin.py 
Log Message:
When a frozen executable, we come a mini-installer EXE for the DLL.
See the comments for more information.


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.123
retrieving revision 1.124
diff -C2 -d -r1.123 -r1.124
*** addin.py	20 Dec 2003 23:10:50 -0000	1.123
--- addin.py	22 Dec 2003 03:16:29 -0000	1.124
***************
*** 1520,1523 ****
--- 1520,1539 ----
  
  if __name__ == '__main__':
+     # woohoo - here is a wicked hack.  If we are a frozen .EXE, then we are
+     # a mini "registration" utility.  However, we still want to register the
+     # DLL, *not* us.  Pretend we are frozen in that DLL.
+     # NOTE: This is only needed due to problems with Inno Setup unregistering
+     # our DLL the 'normal' way, but then being unable to remove the files as
+     # they are in use (presumably by Inno doing the unregister!).  If this
+     # problem ever goes away, so will the need for this to be frozen as
+     # an executable.  In all cases other than as above, 'regsvr32 dll_name'
+     # is still the preferred way of registering our binary.
+     if hasattr(sys, "frozen"):
+         sys.frozendllhandle = win32api.LoadLibrary("outlook_addin.dll")
+         sys.frozen = "dll"
+         # Without this, com registration will look at class.__module__, and
+         # get all confused about the module name holding our class in the DLL
+         OutlookAddin._reg_class_spec_ = "addin.OutlookAddin"
+         # And continue doing the registration with our hacked environment.
      import win32com.server.register
      win32com.server.register.UseCommandLine(OutlookAddin)





More information about the Spambayes-checkins mailing list