Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access/Assign in COM Object?
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00481355
Message ID:
00484031
Views:
16
>*snip*
>>>
>>>Set Procedure to d:\wintemp\killthis
>>>oK = CreateObject("killthis", <b>"aa"</b>)
>>><b>*</b> ? oK.init("aa")
>>>
>>>
>>>But I thought I would see "aa" as a return value but instead I get "SOURCENAME!.T.". The birp.wav is playing, so I know the Assign method is firing. Where did I goof?
>>
>>The "goof" is that you did not actually assign the value. I've made the necessary modification in bold above. The assign event allows you to change or even by-pass the assignment of the variable. Note also that the Init even fires on CreateObject() and to pass a parameter to it all you have to do is pass it there (again in bold above).
>>
>
>George/Steve,
>When using COM, parameters get lost when passed to the Init during instantiation. You need to either call Init again with the parameters (which I don't recommend at all) or create another method that accepts parameters and use it to perform any processing you need (which I do recommend).
>
>Just my $0.02.

Larry,

Thanks for the heads up. Forgot about that. I tested the code from within a prg without compiling it into a DLL. As a result, I forgot about the "lost" parameter business. Also, I agree about calling Init. I'd expose a method to do the assignment externally if necessary, or simply assign it externally. Both with cause the _Assign to fire.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform