Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing by reference
Message
De
18/06/2002 12:50:36
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00668296
Message ID:
00669815
Vues:
41
I knew about drilling down through an containership heirarchy of a COM object. But are you saying that a COM object method can return a reference to a another object that is not a COM object? eg.
loFactoryCOM = createobject("exe.factory")
loNonCOM = loFactoryCOM.GetRefToNonCOM()
loFactoryCOM = null
loNonCOM.method()  && this works?
>>"Container" class is not OLEPUBLIC, so the object reference has no meaning across COM. I second David about the @. about "thisform", is the form OLEPUBLIC?
>
>That's not right. Once you have a parent COM reference you can drill down to all the client references using COM. You can pass back COM references to the caller for example with factory methods even if those objects you pass back are not defined OLEPUBLIC.
>
>I haven't tried this with UI objects such as containers, but I use this stuff extensively in Help Builder's GUI Automation interface to access forms and that works well...
>
>+++ Rick ---
>
>
>>
>>>David
>>>
>>>No I can definitely pass the object through. I created a form and saved it as 'hf1.scx'
>>>
>>>On that form I have a commandbutton which has the following code
>>>
>>>
>>>oDll=CREATEOBJECT('d1.interface')
>>>lcnt=oDll.InterInit(@hf1)
>>>RELEASE oDll
>>>
>>>
>>>My dll has the following
>>>
>>>
>>>DEFINE CLASS Interface AS CUSTOM OLEPUBLIC
>>> PROCEDURE InterInit
>>> PARAMETERS pForm as Form
>>>
>>> WITH pForm
>>>  .AddObject('myContainer','Container')  && Add a Container to the form
>>>  .myContainer.height=150
>>>  .myContainer.width=150
>>>  .myContainer.top=1
>>>  .myContainer.left=1
>>>  .myContainer.visible=.T.
>>> ENDWITH
>>>
>>> RETURN @pForm.myContainer
>>>ENDPROC
>>>ENDDEFINE
>>>
>>>
>>>this adds the container to my form. What I dont understand is why I cannot pass 'THISFORM'
>>>
>>>regards
>>>Geoff
>>>
>>>
>>>>Geoff,
>>>>
>>>>Ok, I'm pretty sure that you can't pass an object reference across the COM boundary.
>>>>
>>>>Why not let your app simply make calls into the COM object to carry out the allowed tasks? Or let your COM return a value that allows the app to instantiate the container itself?
>>>>
>>>>>I was getting an object does not exist message.
>>>>>
>>>>>The dll was created using VFP7
>>>>>
>>>>>I have an application which interfaces to multiple accounting packages. Each package has different options and settings. My DLL adds a container object to the main applications setting form with that interfaces options.
>>>>>
>>>>>The DLL also handles the mapping (import/export) functions to the main applications tables.
>>>>>
>>>>>The main application is generic in that the application tables vary from implimentation to implimentation.
>>>>>
>>>>>What I do not understand is how to create a pointer to my current form (ie @THISFORM or @THIS.PARENT)
>>>>>
>>>>>Also, when I check for the existence of a form it looks for a form using the name property for that form, yet I cannot reference the form object using that name.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform