ActiveX Questions

Rony rony.steelandt at bucodi.com
Tue Feb 19 09:34:41 CET 2002


Michael Kelly <mkelly2002NOSPAM at earthlink.net> wrote in message news:<nlh27ukfu8u2ga4g2n876b211idb024rkt at 4ax.com>...
> Out of curiosity, did they give you a type library
> with the control?  Also you might try running
> it through Makepy with -o option to get a module?
> Perhaps if you posted the CoClass part of the
> ActiveX module produced by Makepy somebody 
> could see if something is weird.

Still no succes with that one :(
It don't seems to me that it needs a hosting form, it looks like it
creates it own modal form to me

Here is the file created by makepy :
#------------------------------------
# Created by makepy.py version 0.3.3
# From type library 'REPORTOCX.OCX'
# On Sun Feb 17 17:18:27 2002
"""ReportOcx ActiveX Control module"""
makepy_version = '0.3.3'

import win32com.client.CLSIDToClass, pythoncom

# The following 3 lines may need tweaking for the particular server
# Candidates are pythoncom.Missing and pythoncom.Empty
defaultNamedOptArg=pythoncom.Missing
defaultNamedNotOptArg=pythoncom.Missing
defaultUnnamedArg=pythoncom.Missing

CLSID = pythoncom.MakeIID('{E80AB8D2-EB1E-49EE-8C2A-57BB2E70302A}')
MajorVersion = 1
MinorVersion = 0
LibraryFlags = 10
LCID = 0x0

from win32com.client import DispatchBaseClass
class _DReportOcx(DispatchBaseClass):
	"""Dispatch interface for ReportOcx Control"""
	CLSID = pythoncom.MakeIID('{BE1E9308-9F3C-4D83-B7BC-D0F6F6DCE778}')

	def AboutBox(self):
		return self._oleobj_.InvokeTypes(0xfffffdd8, LCID, 1, (24, 0), (),)

	def AddRecord(self, szRecordString=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x2f, LCID, 1, (24, 0), ((8,
0),),szRecordString)

	def Clear(self):
		return self._oleobj_.InvokeTypes(0x3c, LCID, 1, (24, 0), (),)

	def DoPrint(self):
		return self._oleobj_.InvokeTypes(0x33, LCID, 1, (11, 0), (),)

	def DoPrintPreview(self):
		return self._oleobj_.InvokeTypes(0x34, LCID, 1, (11, 0), (),)

	def DoPrinterSetup(self):
		return self._oleobj_.InvokeTypes(0x35, LCID, 1, (11, 0), (),)

	def GetPageHeight(self):
		return self._oleobj_.InvokeTypes(0x31, LCID, 1, (3, 0), (),)

	def GetPageWidth(self):
		return self._oleobj_.InvokeTypes(0x32, LCID, 1, (3, 0), (),)

	def GetPages(self):
		return self._oleobj_.InvokeTypes(0x30, LCID, 1, (2, 0), (),)

	def SetBottomString(self, szBottomString=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x2c, LCID, 1, (24, 0), ((8,
0),),szBottomString)

	def SetChangePageLine(self, cPageLine=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x2e, LCID, 1, (24, 0), ((2,
0),),cPageLine)

	def SetColAlign(self, szFmt=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x39, LCID, 1, (24, 0), ((8,
0),),szFmt)

	def SetColNums(self, nColNums=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0xf, LCID, 1, (24, 0), ((2,
0),),nColNums)

	def SetFixedLeftMargin(self, nFixedLeftMargin=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x11, LCID, 1, (24, 0), ((2,
0),),nFixedLeftMargin)

	def SetFixedTopMargin(self, nFixedTopMargin=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x10, LCID, 1, (24, 0), ((2,
0),),nFixedTopMargin)

	def SetGridHeadLineColor(self,
nGridHeadLineColor=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x1b, LCID, 1, (24, 0), ((3,
0),),nGridHeadLineColor)

	def SetGridLineColor(self, nGridLineColor=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x1c, LCID, 1, (24, 0), ((3,
0),),nGridLineColor)

	def SetPageFoot(self, szPageFoot=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x37, LCID, 1, (24, 0), ((8,
0),),szPageFoot)

	def SetPageFootAlign(self, cAlign=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x1d, LCID, 1, (24, 0), ((2,
0),),cAlign)

	def SetPageFootFormat(self, szFontName=defaultNamedNotOptArg,
cxSize=defaultNamedNotOptArg, cySize=defaultNamedNotOptArg,
nTextColor=defaultNamedNotOptArg, bBold=defaultNamedNotOptArg,
bItalic=defaultNamedNotOptArg, bUnderline=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x25, LCID, 1, (24, 0), ((8, 0),
(2, 0), (2, 0), (3, 0), (11, 0), (11, 0), (11, 0)),szFontName, cxSize,
cySize, nTextColor, bBold, bItalic, bUnderline)

	def SetPageFootLineColor(self,
nPageFootLineColor=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x19, LCID, 1, (24, 0), ((3,
0),),nPageFootLineColor)

	def SetPageHead(self, szPageHead=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x36, LCID, 1, (24, 0), ((8,
0),),szPageHead)

	def SetPageHeadAlign(self, cAlign=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x21, LCID, 1, (24, 0), ((2,
0),),cAlign)

	def SetPageHeadFormat(self, szFontName=defaultNamedNotOptArg,
cxSize=defaultNamedNotOptArg, cySize=defaultNamedNotOptArg,
nTextColor=defaultNamedNotOptArg, bBold=defaultNamedNotOptArg,
bItalic=defaultNamedNotOptArg, bUnderline=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x26, LCID, 1, (24, 0), ((8, 0),
(2, 0), (2, 0), (3, 0), (11, 0), (11, 0), (11, 0)),szFontName, cxSize,
cySize, nTextColor, bBold, bItalic, bUnderline)

	def SetPageHeadLineColor(self,
nPageHeadLineColor=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x1a, LCID, 1, (24, 0), ((3,
0),),nPageHeadLineColor)

	def SetRecordAlign(self, cAlign=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x1e, LCID, 1, (24, 0), ((2,
0),),cAlign)

	def SetRecordBackColor(self, nRecordBackColor=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x3b, LCID, 1, (24, 0), ((3,
0),),nRecordBackColor)

	def SetRecordBottomMargin(self,
nRecordBottomMargin=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x16, LCID, 1, (24, 0), ((2,
0),),nRecordBottomMargin)

	def SetRecordFormat(self, szFontName=defaultNamedNotOptArg,
cxSize=defaultNamedNotOptArg, cySize=defaultNamedNotOptArg,
nTextColor=defaultNamedNotOptArg, bBold=defaultNamedNotOptArg,
bItalic=defaultNamedNotOptArg, bUnderline=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x23, LCID, 1, (24, 0), ((8, 0),
(2, 0), (2, 0), (3, 0), (11, 0), (11, 0), (11, 0)),szFontName, cxSize,
cySize, nTextColor, bBold, bItalic, bUnderline)

	def SetRecordHeight(self, nRecordHeight=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x15, LCID, 1, (24, 0), ((2,
0),),nRecordHeight)

	def SetRecordTopMargin(self, nRecordTopMargin=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x17, LCID, 1, (24, 0), ((2,
0),),nRecordTopMargin)

	def SetReportHeadBackColor(self,
nReportHeadBackColor=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x3a, LCID, 1, (24, 0), ((3,
0),),nReportHeadBackColor)

	def SetReportHeadFormat(self, szFontName=defaultNamedNotOptArg,
cxSize=defaultNamedNotOptArg, cySize=defaultNamedNotOptArg,
nTextColor=defaultNamedNotOptArg, bBold=defaultNamedNotOptArg,
bItalic=defaultNamedNotOptArg, bUnderline=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x24, LCID, 1, (24, 0), ((8, 0),
(2, 0), (2, 0), (3, 0), (11, 0), (11, 0), (11, 0)),szFontName, cxSize,
cySize, nTextColor, bBold, bItalic, bUnderline)

	def SetReportHeadHeight(self,
nReportHeadHeight=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x14, LCID, 1, (24, 0), ((2,
0),),nReportHeadHeight)

	def SetReportSubTitle(self, szFormat=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x2a, LCID, 1, (24, 0), ((8,
0),),szFormat)

	def SetReportSubTitleHeight(self,
nReportSubTitleHeight=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x13, LCID, 1, (24, 0), ((2,
0),),nReportSubTitleHeight)

	def SetReportSubTitleRowsCols(self,
nReportSubTitleRows=defaultNamedNotOptArg,
nRecordSunTitleCols=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x18, LCID, 1, (24, 0), ((2, 0),
(2, 0)),nReportSubTitleRows, nRecordSunTitleCols)

	def SetReportTitle(self, szReportTitle=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x38, LCID, 1, (24, 0), ((8,
0),),szReportTitle)

	def SetReportTitleHeight(self,
nReportTitleHeight=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x12, LCID, 1, (24, 0), ((2,
0),),nReportTitleHeight)

	def SetReportTotal(self, szFormat=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x29, LCID, 1, (24, 0), ((8,
0),),szFormat)

	def SetSubTitleAlign(self, cAlign=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x1f, LCID, 1, (24, 0), ((2,
0),),cAlign)

	def SetSubTitleFormat(self, szFontName=defaultNamedNotOptArg,
cxSize=defaultNamedNotOptArg, cySize=defaultNamedNotOptArg,
nTextColor=defaultNamedNotOptArg, bBold=defaultNamedNotOptArg,
bItalic=defaultNamedNotOptArg, bUnderline=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x27, LCID, 1, (24, 0), ((8, 0),
(2, 0), (2, 0), (3, 0), (11, 0), (11, 0), (11, 0)),szFontName, cxSize,
cySize, nTextColor, bBold, bItalic, bUnderline)

	def SetTitleAlign(self, cAlign=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x20, LCID, 1, (24, 0), ((2,
0),),cAlign)

	def SetTitleFormat(self, szFontName=defaultNamedNotOptArg,
cxSize=defaultNamedNotOptArg, cySize=defaultNamedNotOptArg,
nTextColor=defaultNamedNotOptArg, bBold=defaultNamedNotOptArg,
bItalic=defaultNamedNotOptArg, bUnderline=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x28, LCID, 1, (24, 0), ((8, 0),
(2, 0), (2, 0), (3, 0), (11, 0), (11, 0), (11, 0)),szFontName, cxSize,
cySize, nTextColor, bBold, bItalic, bUnderline)

	def SetTopString(self, szTopString=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x2b, LCID, 1, (24, 0), ((8,
0),),szTopString)

	def SetTotalFormat(self, szFontName=defaultNamedNotOptArg,
cxSize=defaultNamedNotOptArg, cySize=defaultNamedNotOptArg,
nTextColor=defaultNamedNotOptArg, bBold=defaultNamedNotOptArg,
bItalic=defaultNamedNotOptArg, bUnderline=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x22, LCID, 1, (24, 0), ((8, 0),
(2, 0), (2, 0), (3, 0), (11, 0), (11, 0), (11, 0)),szFontName, cxSize,
cySize, nTextColor, bBold, bItalic, bUnderline)

	def SetWidthString(self, szWidthString=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x2d, LCID, 1, (24, 0), ((8,
0),),szWidthString)

	_prop_map_get_ = {
		"Appearance": (-520, 2, (2, 0), (), "Appearance", None),
		"BackColor": (-501, 2, (19, 0), (), "BackColor", None),
		"BorderStyle": (-504, 2, (2, 0), (), "BorderStyle", None),
		"Caption": (-518, 2, (8, 0), (), "Caption", None),
		"Enabled": (-514, 2, (11, 0), (), "Enabled", None),
		# Property 'Font' is an object of type 'Font'
		"Font": (-512, 2, (9, 0), (), "Font",
'{BEF6E003-A874-101A-8BBA-00AA00300CAB}'),
		"FontBold": (6, 2, (11, 0), (), "FontBold", None),
		"FontItalic": (7, 2, (11, 0), (), "FontItalic", None),
		"FontName": (4, 2, (8, 0), (), "FontName", None),
		"FontSize": (5, 2, (2, 0), (), "FontSize", None),
		"FontUnderline": (8, 2, (11, 0), (), "FontUnderline", None),
		"FootLine": (13, 2, (11, 0), (), "FootLine", None),
		"ForeColor": (-513, 2, (19, 0), (), "ForeColor", None),
		"HeadLine": (14, 2, (11, 0), (), "HeadLine", None),
		"Height": (10, 2, (2, 0), (), "Height", None),
		"ReadyState": (-525, 2, (3, 0), (), "ReadyState", None),
		"Visible": (11, 2, (11, 0), (), "Visible", None),
		"Width": (9, 2, (2, 0), (), "Width", None),
		"bHeadLine": (12, 2, (11, 0), (), "bHeadLine", None),
		"hWnd": (-515, 2, (3, 0), (), "hWnd", None),
	}
	_prop_map_put_ = {
		"Appearance" : ((-520, LCID, 4, 0),()),
		"BackColor" : ((-501, LCID, 4, 0),()),
		"BorderStyle" : ((-504, LCID, 4, 0),()),
		"Caption" : ((-518, LCID, 4, 0),()),
		"Enabled" : ((-514, LCID, 4, 0),()),
		"Font" : ((-512, LCID, 4, 0),()),
		"FontBold" : ((6, LCID, 4, 0),()),
		"FontItalic" : ((7, LCID, 4, 0),()),
		"FontName" : ((4, LCID, 4, 0),()),
		"FontSize" : ((5, LCID, 4, 0),()),
		"FontUnderline" : ((8, LCID, 4, 0),()),
		"FootLine" : ((13, LCID, 4, 0),()),
		"ForeColor" : ((-513, LCID, 4, 0),()),
		"HeadLine" : ((14, LCID, 4, 0),()),
		"Height" : ((10, LCID, 4, 0),()),
		"ReadyState" : ((-525, LCID, 4, 0),()),
		"Visible" : ((11, LCID, 4, 0),()),
		"Width" : ((9, LCID, 4, 0),()),
		"bHeadLine" : ((12, LCID, 4, 0),()),
		"hWnd" : ((-515, LCID, 4, 0),()),
	}

# Little helper to transform event arguments to more usable objects.
from pywintypes import UnicodeType
dispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch]
def transformarg(arg):
	if type(arg)==dispatchType:
		return Dispatch(arg)
	elif type(arg)==UnicodeType:
		return str(arg)
	return arg
arg_transformer = lambda object, args: map(transformarg, args)

class _DReportOcxEvents:
	"Event interface for ReportOcx Control"
	CLSID = CLSID_Sink =
pythoncom.MakeIID('{AF07ADBE-9F30-4E5E-B377-B9ABD83B0E28}')
	_public_methods_ = [] # For COM Server support
	_arg_transformer_ = arg_transformer
	_dispid_to_func_ = {
		        1 : "OnUserError",
		}

	def __init__(self, oobj = None):
		if oobj is None:
			self._olecp = None
		else:
			import win32com.server.util
			cpc=oobj._oleobj_.QueryInterface(pythoncom.IID_IConnectionPointContainer)
			cp=cpc.FindConnectionPoint(self.CLSID_Sink)
			cookie=cp.Advise(win32com.server.util.wrap(self))
			self._olecp,self._olecp_cookie = cp,cookie
	def __del__(self):
		try:
			self.close()
		except pythoncom.com_error:
			pass
	def close(self):
		if self._olecp is not None:
			cp,cookie,self._olecp,self._olecp_cookie =
self._olecp,self._olecp_cookie,None,None
			cp.Unadvise(cookie)
	def _query_interface_(self, iid):
		import win32com.server.util
		if iid==self.CLSID_Sink: return win32com.server.util.wrap(self)

	# Handlers for the control
	# If you create handlers, they should have the following prototypes:
#	def OnUserError(self, nErrCode=defaultNamedNotOptArg):

class CoClassBaseClass:
	def __init__(self, oobj=None):
		if oobj is None: oobj = pythoncom.new(self.CLSID)
		self.__dict__["_dispobj_"] = self.default_interface(oobj)
	def __repr__(self):
		return "<win32com.gen_py.%s.%s>" % (__doc__,
self.__class__.__name__)

	def __getattr__(self, attr):
		d=self.__dict__["_dispobj_"]
		if d is not None: return getattr(d, attr)
		raise AttributeError, attr
	def __setattr__(self, attr, value):
		if self.__dict__.has_key(attr): self.__dict__[attr] = value; return
		try:
			d=self.__dict__["_dispobj_"]
			if d is not None:
				d.__setattr__(attr, value)
				return
		except AttributeError:
			pass
		self.__dict__[attr] = value

# This CoClass is known by the name 'REPORTOCX.ReportOcxCtrl.1'
class ReportOcx(CoClassBaseClass): # A CoClass
	# ReportOcx Control
	CLSID = pythoncom.MakeIID("{856933B7-BD84-4308-AA83-486418BC9EC3}")
	coclass_sources = [
		_DReportOcxEvents,
	]
	default_source = _DReportOcxEvents
	coclass_interfaces = [
		_DReportOcx,
	]
	default_interface = _DReportOcx

RecordMap = {
}

CLSIDToClassMap = {
	'{AF07ADBE-9F30-4E5E-B377-B9ABD83B0E28}' : _DReportOcxEvents,
	'{856933B7-BD84-4308-AA83-486418BC9EC3}' : ReportOcx,
	'{BE1E9308-9F3C-4D83-B7BC-D0F6F6DCE778}' : _DReportOcx,
}
CLSIDToPackageMap = {}

win32com.client.CLSIDToClass.RegisterCLSIDsFromDict( CLSIDToClassMap )



More information about the Python-list mailing list