Returning Floats and Doubles from Automation methods

Last reviewed: April 21, 1995
Article ID: Q122286
The information in this article applies to:
  • Microsoft OLE Libraries for Windows and Win32s, version 2.02

SUMMARY

Automation properties or methods implemented with the C calling convention in the Windows 16-bit operating system can't return type Float or Double. This includes the Date type, which is a floating-point type. To work around this, you can implement them using the Pascal calling convention.

MORE INFORMATION

Automation methods and properties can be marked as using one of the calling conventions described by the CALLCONV enumeration. This calling convention is used by the standard IDispatch implementation provided by CreateStdDispatch and by DispInvoke to call property accessor functions or methods. Note that the an automation controller does not directly use these calling conventions.

Because of a C Language implementation limitation, automation properties and methods that return Float or Double cannot use the C calling convention. You need to use the Pascal calling convention.

For example, describe a method or automation property that returns a Float or Double as follows in the .ODL file:

[propget] float pascal MyProperty(); float pascal MyMethod();


Additional reference words: 2.00
KBCategory: kbole kbprg
KBSubcategory: LeTwoAto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.