Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VC COM object Returning a Logical Result
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00106809
Message ID:
00107520
Views:
19
>The following is a message from a co-worker, does anyone know?
>
>-------
>
>I'm writing a simple COM object in VC++ 5.0 that will be used in VFP 5.0. The control has a single interface that has four basic functions. One returns a string, one returns an int, on returns a float, and one returns a BOOL. In VB, all four functions seem to work fine. In VFP, all work fine except the method that returns a BOOL. VFP gets a 0 or a 1 from it, not a .t. or .f. (it gets an integer, not a logical).
>
>In the COM IDL file, I define the function as:
>[id(6), helpstring("...")] HRESULT GetBoolInfo([in]BSTR bstrRequest, [out, retval]BOOL *pbInfo);
>
>Does anyone have any idea what I need to do to get VFP to recognize the [retval] parameter as a VFP logical variable? Is this even posible?

The standard BOOL return from C++ is a SHORT; if you wrap the result in an IIF(), you'll get what you want:

lMyResult = IIF(MyDLLFunctionCall() = 0, .F., .T.)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform