Hello!

I use win32com module and everything is ok but I cannot find the way how to
pass VT_DECIMAL variant value to COM object's method.


There is a COM interface:
interface IProperty : IDispatch
{
...
 [propget, id(DISPID_VALUE)]
 HRESULT Value([out, retval] VARIANT* pVal);

 [propput, id(DISPID_VALUE)]
 HRESULT Value([in] VARIANT new_value);
...
}

This is how the interface is described in gencache:
class IProperty(DispatchBaseClass):
CLSID = IID('{0A4C05A0-107B-4A8B-9E34-44ED9B117A25}')
coclass_clsid = IID('{2171DCF1-B70B-4CAB-9EB7-F7FED71956B4}')

_prop_map_get_ = {
"Value": (0, 2, (12, 0), (), "Value", None),
}
_prop_map_put_ = {
"Value": ((0, LCID, 4, 0),()),
}
...

In python code I get the object by the following way:

comObj = win32com.client.Dispatch("XXX.XXX.4")
prop = comObj.Property # prop is IProperty

The problem is here:
prop.Value = 0.123456

I need to pass here VT_DECIMAL variant (due to data precision requirements)
but it comes to COM object implementation as VT_R8 variant.
I tried to use decimal python type but it comes as VT_CY variant.

Could you help me to find out how to pass VT_DECIMAL variant from python to
COM?
I would appreciate your help very much!


Regards,
Nikita Lepetukhin
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to