[PHP] COM and the PHP equivalent of ASP Currency data type

2008-12-04 Thread Alex Bovey
Hi all,

I am working with a COM interface and the specification which is wrtten for
ASP calls for a Currency data type to be passed to a function.  What is
the equivalent in PHP?

If I call com_print_typeinfo() I can see that the function has the following
info:

function GetPrice(
/* VT_PTR [26] [in][out] -- VT_VARIANT [12]  */ $Account,
/* VT_PTR [26] [in][out] -- VT_CY [6]  */ $Quant,
/* VT_PTR [26] [in][out] -- VT_I2 [2]  */ $QuantMult,
/* VT_PTR [26] [in][out] -- VT_I2 [2]  */ $prMult
)

The parameter I am having problems with parameter 2 - $Quant.

I tried to create a VARIANT of type VT_CY so I did:

$qty = new VARIANT('1.', VT_CY);

The error I am getting is:

Uncaught exception 'com_exception' with message 'Parameter 2: Type mismatch.


Thanks all,

Alex

-

Alex Bovey
Web Developer | Alex Bovey Consultancy Ltd
Registered in England  Wales no. 6471391 | VAT no. 934 8959 65
PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility


Re: [PHP] COM and the PHP equivalent of ASP Currency data type

2008-12-04 Thread Jochem Maas
Alex Bovey schreef:
 Hi all,
 
 I am working with a COM interface and the specification which is wrtten for
 ASP calls for a Currency data type to be passed to a function.  What is
 the equivalent in PHP?
 
 If I call com_print_typeinfo() I can see that the function has the following
 info:
 
 function GetPrice(
 /* VT_PTR [26] [in][out] -- VT_VARIANT [12]  */ $Account,
 /* VT_PTR [26] [in][out] -- VT_CY [6]  */ $Quant,
 /* VT_PTR [26] [in][out] -- VT_I2 [2]  */ $QuantMult,
 /* VT_PTR [26] [in][out] -- VT_I2 [2]  */ $prMult
 )
 
 The parameter I am having problems with parameter 2 - $Quant.
 
 I tried to create a VARIANT of type VT_CY so I did:
 
 $qty = new VARIANT('1.', VT_CY);

total guess work from me:

$qty = new VARIANT('1', VT_CY);

i.e. use an 'int' rather than a 'float'

or maybe just

$qty = new VARIANT(1);

 
 The error I am getting is:
 
 Uncaught exception 'com_exception' with message 'Parameter 2: Type mismatch.


you might try catching the exception and see if it contains any more
useful info.

 
 Thanks all,
 
 Alex
 
 -
 
 Alex Bovey
 Web Developer | Alex Bovey Consultancy Ltd
 Registered in England  Wales no. 6471391 | VAT no. 934 8959 65
 PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php