Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM & Data Types
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00393575
Message ID:
00394337
Views:
10
Hi Rick,

>The obvious question here is why would you do such a thing? This is extremely bad design.

Bad Design? It was not my intent to change the data type of the incoming parameter. Let me explain.

We have a COM object with a method that accepts a parameter passed by reference. It populates that parameter with a certain string, dependant upon other factors. It returns the length of the string, or 0 if an error occurs(somewhat similar to that of the GetShortPathName API function).

What prompted my question was, one of my colleagues declared a variable, and before initializing it to character data type, passed the variable to the COM object. Since the method was successful, it returned the length of the path, however, the variable he had passed by reference was still of logical type because he hadnt initialized it prior to passing it.

Just FYI, there's now an upfront test that the parameter passed by reference is of character type. If not, it returns an error. I know, i know....it should have been there in the first place. :-)

Thanks for replying.

Jon
>
>Internally VFP can do the conversion easily enough, but externally the COM Variant is fixed when it enters the VFP server and comes out with the same type.
>
>+++ Rick ---
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform