Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

createobject of antoher foxpro exe

Status
Not open for further replies.

josedeman

Programmer
Jan 20, 2004
23
NL
Is it at all possible to create an instance of a foxpro application/exe from within another foxpro application/exe?
I've tried to do that with createobject() (after building my exe as a com server) but as far as I know that doesn't give me a user interface.
I would like to create an object that I can talk to from my other foxpro exe and show results in a form that lives in the created object just like I do when I use for example Office automation.
 

Is the application designed to be a COM server? Do you have an OLE PUBLIC class?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes and yes.
I think I've got it. The key is you need only one OLE PUBLIC class and within that class you can define other procedures that run forms etc.
Now I only have to figure out how to close the object and to senf information there and back

Thanx!
 
You may have several ole public classes. Office also offers this:

Code:
oWordExe = createobject("Word.Application")
? oWordExe.Documents.Count
oWordDoc = createobject("Word.Document")
? oWordDoc.Name
? oWordExe.ActiveDocument.Name
? oWordExe.Documents.Count

You should offer a method for closing the object like Word does with QUIT. Just Releasing the Object may not quit the whole application:

Code:
Release oWordExe
* Word still exists, you can see winword.exe 
* running in the taskmanagers Processes Tab.

* instead this should be done with
oWordExe.Quit()
* OR
oWordDoc.Application.Quit()
Release oWordDoc, oWordExe

This has all the problems attached with user interaction and safety questions asked by word ("do you want to save modifications of Document1?"), that you don't see with the Quit()-Call, as it instantly returns with .null. before the user answers yes/no.

So if you do this with your own application you have to consider those cases and perhaps make it better than Microsoft...

Sending informations back and fourth can be done as always by method call parameters and return values and/or you use tables to communicate and share data.

Bye, Olaf.
 
Yes, EXE server can have it's own user interface (oposite to DLL servers). Maybe you need READ EVENTS inside the methods of EXE COM server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top