>Hi,
>
>>Is the AddProperty() method allowed in COM implementation?
>
>It's allowed - but since the property is added at runtime it will not be available via the COM interface (which is defined at compile time). For example with the following DLL:
I know it will not crash the program, but in the implementation I need, it has to be 'added' to the session class without instantiating a local instance of the object.
I'm using VFP7 (can't use collection), and I changed my implementation to use an array and it works without
having to use a local instance of the object.
Thank you for the feedback.
>
>DEFINE CLASS Viv AS SESSION OLEPUBLIC
> PROCEDURE ADDP(NAME,CLASS)
> o = CREATEOBJECT(NAME)
> THIS.ADDPROPERTY(NAME,o)
> ENDPROC
> PROCEDURE ReturnValue(x)
> RETURN EVALUATE(x)
> ENDPROC
>ENDDEFINE
>
>DEFINE CLASS VivTest AS CURSOR
> ss = "Hello, world"
>ENDDEFINE
>
>
>then
>
>lO = CreateObject("whatever.whatever")
>lO.AddP("VivTest")
>? lO.ReturnValue("this.VivText.ss")
>
>
>works showing that the object was created OK but only visible through Properties/Methods exposed in the COM interface...
>
>HTH,
>Viv
ramil
~~ learning to stand still