Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing by reference
Message
De
14/06/2002 04:03:11
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00668296
Message ID:
00668401
Vues:
23
This message has been marked as the solution to the initial question of the thread.
Geoff,
Using directly hf1 wouldn't work for you on the long run because only first instance of that form could use the scx name as object name. Form name wouldn't work either because not always the several instances of a form have different names (ie: a series of 'do form myForm' would end a lot of forms with name 'myForm' -assuming their name is set to myName-).

oForm = thisform
oDll.InterInit(@oForm)

would do. However directly using thisform is the way to go IMO :)
Difference between oForm and thisform is that thisform is already a pointer :) IOW do not prepend with @.

oDll.InterInit(thisform)

Cetin

>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.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform