<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Pythoncom does its conversions in oleargs.cpp in the source
tree.&nbsp; My guess is that we are hitting a path causing one of the &#8220;*_AsLong&#8221;
or similar functions to fail, returning -1, but we don&#8217;t check that error
condition.&nbsp; However, the best I can tell, the test suite does try and
cover these cases (see win32com\test\testpycomtest.py and search for &#8220;ulong&#8221;).&nbsp;
Also, things behave differently based on whether typeinfo is available &#8211;
if it is not, Python &#8220;guesses&#8221; about the variant type based on the
python type, but if it is known, python attempts to convert the python value to
the requested type.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Can you provide any more info, or suggest how testpycomtest
could be modified to demonstrate the problem?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Mark<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
python-win32-bounces+mhammond=keypoint.com.au@python.org
[mailto:python-win32-bounces+mhammond=keypoint.com.au@python.org] <b>On Behalf
Of </b>Chen<br>
<b>Sent:</b> Friday, 22 February 2008 3:21 AM<br>
<b>To:</b> python-win32@python.org<br>
<b>Subject:</b> [python-win32] Data Type Conversion in Python Win32 COM<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Hello,<br>
<br>
I have a question regarding to how Data type is being converted into COM
object.<br>
<br>
For example, there is a function A in one COM object that requires an Unsigned
32 bit Integer as a parameter. How could I pass a Long Integer in python to
Function A.<br>
<br>
I found that if the parameter is smaller or equal to ( 2^31 -1 ), the parameter
is correctly passed to Function A. Any value that bigger than ( 2 ^31 - 1) will
be interpreted as 0xFFFFFFFF. Does Python Win32 COM has its own data conversion
if the data type of the passed parameter is different from the data type of the
required parameter. If yes, how python win32 COM does the conversion?<br>
<br>
Thanks<br>
<br>
<br>
Chen<o:p></o:p></p>

</div>

</div>

</body>

</html>