PythonCOM: implementing properties with parameters

Larry Howard howardlp at isis.vanderbilt.edu
Wed Oct 17 16:58:26 CEST 2001


How would I implement an interface with a property such as this using PythonCOM?

dispinterface IDispComponent {
  ...
  [id(0x60020003), propput, helpstring("property ComponentParameter")]
  void ComponentParameter([in] BSTR Name, [in] VARIANT rhs);
  [id(0x60020003), propget, helpstring("property ComponentParameter")]
  VARIANT ComponentParameter([in] BSTR Name);
  ...
}

VB:
Property Get ComponentParameter(key As String) As Variant
	...
End Property

Property Let ComponentParameter(key As String, value As Variant)
   	...
End Property

cpp:
STDMETHODIMP COMCLASS::get_ComponentParameter(BSTR name, VARIANT *pVal) {
	...
}
STDMETHODIMP COMCLASS::put_ComponentParameter(BSTR name, VARIANT newVal) {
	...	
}

lph
--
Larry Howard
Institute for Software Integrated Systems, Vanderbilt University
howardlp at isis.vanderbilt.edu   voice: (615) 343-7447 fax: (615) 343-7440



More information about the Python-list mailing list