Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Parameters Between VB and VFP Com Objects
Message
 
 
À
05/01/2001 21:41:29
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00460139
Message ID:
00460364
Vues:
15
Hi!

It is not recommended to pass parameters by reference to any COM objects that work in the Out of process model. Probably WEB server instantiates them in such way, thus COM objects work in different memory spaces, preventing any correct variable addressing. Thus, parameter passed by reference from ASP page makes no sense for VB or VFP COM object because pointer cannot be used at all. Assure all objects work using in-process model (DLLs only). In addition, when you will not reach good results, (when you cannot reach this using WEB server), workaround you meantioned will work. However, you should not than register COM objects under MTS, just because by such workaround you broke the rule for COM objects to be stateless under MTS (saving file name into property in VFP COM object and getting this value by separate function - stateless working).

Note that you can change also the way VFP object returns result. If function failed - it returns empty string. If success - file name. Thus only one value to return - no need to pass parameters by reference.


>Background: I have created a VFP com object which is instantiated from a VB com object for use in a Web application.The VB com obj is instantiated by a web page and passed several parameters, 1 of which ia passed by reference (cfilename) and the rest by value. The VB com object than instantiates the VFP com object passing the required parameters including the cfilename parameter. The VFP com object's role is to create and save an excel file and return an interger, 0 if successful, back to the VP object which than returns to the calling web page which loads the excel sheet in the browser. Since VB by default sends parameters by referenc I assumed (my 1st mistake) that the cfilename parameter in the VB com object would retain the value assigned to it in the VFP com obj.
>
>Problem: The confusing part is that it works fine when run from the web server where the com packages are installed. Debugging code in both objects write the value of the paramters to files and they contain the expected values. However when run from a client machine, the excel file still gets created on the web server (i checked) but the cfilename parameter in the VB object does not retain the name assigned to it in the VFP com object and thus the browser opens a blank page. Also the debug values written by the VFP com show only the 1st paramter passed is correct all other are blank and code in the VFP com object which chceck if a particular param is empty gets fired. Still the file is created correctly based on the passed params. ??
>
>Questions:
>Why does it work when run on the Web server but not from a client machine?
>How do you pass parameters by referenc from a VB object to A VFP con obj?
>Would this work? cfilename =vfpobj.getfilename()?
>
>Thanks for any help you can give!!
>Tom
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform