Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing variables
Message
 
To
21/11/2002 11:37:00
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00725134
Message ID:
00725328
Views:
13
If all you need is a value assigned by COM method to a local variable, you can also
do it this way:
LOCAL MyVar
MyObj = CREATEOBJECT ("MyCOM.SomeClass")
myVar = MyObj.SomeMethod ()   && SomeMethod assigns 100 to MyVar
? MyVar && Shows 100
>Ah, that's it.
>
>Excellent, thanks.
>
>Kev
>
>>Your local variable must be initialized to a numeric value before passing it to the COM method:
>>
>>
LOCAL MyVar
>>MyObj = CREATEOBJECT ("MyCOM.SomeClass")
>>MyObj.SomeMethod (@MyVar)   && SomeMethod assign 1 to MyVar
>>? MyVar && Print out .T.
>>
>>
LOCAL MyVar
>>MyVar = 0
>>MyObj = CREATEOBJECT ("MyCOM.SomeClass")
>>MyObj.SomeMethod (@MyVar)   && SomeMethod assign 1 to MyVar
>>? MyVar && Print out 1
HTH
>>
>>>That's what I thought.
>>>
>>>Only I'm sending a local variable using @ to a COM I created in VFP, and it returns as value .T., when it should be a numeric.
>>>
>>>When I test this using the class library directly from Fox, it works, but when I access the DLL, it fails.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform