[python-win32] number of arguments to CreateControl

Thomas Barket thomas_barket@yahoo.com
Sat, 28 Dec 2002 03:51:19 -0800 (PST)


sorry, i accidently sent this message a moment ago
before it was composed.  thats what happens at 6 am. 
here is what i mean to submit:

ive noticed that the CreateControl, used
to instantiate activex controls, permits only 6
arguments instead of the usual 9.  

the class Control (in activex.py) has the following:

   def CreateControl(self, windowTitle, style, rect,
parent, id):
      clsid = str(self._GetControlCLSID())
      self.__dict__["_obj_"] =
win32ui.CreateControl(clsid, windowTitle, style, rect,
parent, id)


although in the win32win.cpp file, the
!pWnd->CreateControl(clsid, szWndName, style, rect,
pWndParent, id, NULL, bStorage, T2OLE(szLicKey)) call
attempts to use all 9 arguments, and is already
written to correctly parse these extra parameters from
python.

i wonder if it would be okay (ie, not break anything),
to make a v small change to activex.py:

    def CreateControl(self, windowTitle, style, rect,
parent, id, lic_string=None):
        clsid = str(self._GetControlCLSID())
        self.__dict__["_obj_"] =
win32ui.CreateControl(clsid, windowTitle, style, rect,
parent, id, lic_string)
        klass = self._GetDispatchClass()
        dispobj =
klass(win32uiole.GetIDispatchForWindow(self._obj_))
        self.HookOleEvents()
        self.__dict__["_dispobj_"] = dispobj


im only adding the lic_string=None as the last
argument and adding lic_string to the
win32ui.CreateControl call.

however, i cannot verify it actually does anything.  i
have an activex control that requires a license string
that will work fine without one under pythonwin, but i
cant get it to work at all (even with the license
string) under straight console python (it shows me a
win32ui module message box that says the control could
not be created.)  has anyone seen something like this
before?

Tom
thomas_barket@yahoo.com





__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com