Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Basic Non-Visual Class
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00248925
Message ID:
00249327
Views:
17
I'm no COM guru, but I've been reading alot about it to pass the DEFINING ARCHITECTURES exam. It would seem like changing the interface of an COM server would drive the system crazy. Doesn't registering the DLL actually tell the system which interface (i.e. properties) to expect? If those are different, I wonder if that causes an explosion. (I'll bet Rick Strahl could answer this question.)

Until then, you may try a different approach. Make the properties of your DLL fixed but have it create a referenced object that holds the record you're looking at. You could use SCATTER NAME to get the object built for you.

Something like:
DEFINE CLASS Foo AS Custom OLEPUBLIC

  PropertyOne = "One"
  PropertyTwo = "Two"
  oStructure = .NULL.

  PROCEDURE Init

    -- open the table and navigate to the right record
    SCATTER NAME This.oStructure
  ENDPROC

 
  PROCEDURE ReturnValue
  LPARAMETER cProperty
    -- check for errors with PEMSTATUS
    cStructureProp = "This.oStructure." + cProperty
    RETURN &cStructureProp
  ENDPROC

ENDDEFINE
Assuming your calling program actually knows the names of the properties it's looking for, you'd call it like:

ox = CREATEOBJECT("Foo")
?ox.ReturnValue("FirstName")



I don't have time to mock this up and see if it works. I may have a bug up there somewhere. I usually do! :-)

HTH,
Marty
Marty Smith, CSQE
Previous
Reply
Map
View

Click here to load this message in the networking platform