COM Registration Attributes
Bill Bell
bill-bell at bill-bell.hamilton.on.ca
Fri Dec 14 15:37:43 EST 2001
Mark Hammond <MarkH at ActiveState.com> wrote, in part:
> > Thanks, Gordon. I just prototyped a simple COM that needs to
> > declare itself safe for Internet Explorer. Looks like I need to continue
> > to do that in the good old-fashioned way, with 'RegOpenKey', etc.
> > Would seem more elegant to be able to use '_reg_options_'.
> A patch to allow _reg_options_ to do this sort of thing (assuming it did
> not break what it does now) would be welcome :)
I haven't extended _reg_options_. However, since ATL.Registrar lacks
an automation interface I have whipped up a wrapper that provides
access to two of Registrar's methods.
The following fragment is a typical usage:
UseCommandLine ( WebPASSCOMServer )
from win32com.client import Dispatch
from sys import argv
registrar = Dispatch ( 'RegistrarCOMWrapper.Register' )
regString = \
'''
HKCR
{
NoRemove 'CLSID'
{
ForceRemove '{D471BE26-C3C8-4773-B438-041BA612C563}'
{
'Implemented Categories'
{
'{7DD95801-9882-11CF-9FA9-00AA006C42C4}'
'{7DD95802-9882-11CF-9FA9-00AA006C42C4}'
}
}
}
NoRemove 'Component Categories'
{
NoRemove '{7DD95801-9882-11CF-9FA9-00AA006C42C4}'
NoRemove '{7DD95802-9882-11CF-9FA9-00AA006C42C4}'
}
}
'''
// following lines parallel the way 'UseCommandLine' works
if '--unregister' in argv: registrar . StringUnregister (
regString )
else: registrar . StringRegister ( regString )
To me, the nice thing about this approach is that it involves the use
of the '.rgs' scripts that are familiar to people who work with MSVC.
I have done only very limited trials, on Win2K at that. Would welcome
comment, including a suggestion of where I might put this ugly thing
in case someone else might consider using it.
BIll
More information about the Python-list
mailing list