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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

createobject of com server (the sequel)

Status
Not open for further replies.

josedeman

Programmer
Jan 20, 2004
23
NL
So far I've created an instance of a com server I've build in foxpro. This object is designed to show the results of several queries in a form within the com server.
When I issue a read events in the com server the exe that creates the com server object isn't available anymore. When I don't issue a read events in the com server the object runs through its code and closes again only showing the result form for a moment.
What to do?
Does anyone have an example for using forms in com servers perhaps?
 
You can have only ONE read events. It seems making the form modal would be sufficient in this case.

What do you do? something like this?
Code:
LOCAL oComserver
oComserver = Createobject("mycomserverdll.mycomserverclass")
oComserver.querydata()
oComserver.displaydatainform()

If the method ends there, then oComserver (being scoped local) get's killed including the form.

You may instanciate the comserver to a public variable:
Code:
public oComserver
oComserver = Createobject(...)
...

Bye, Olaf.
 
What I've done so far is:
I have created a form that has been saved as class and made OLE public. After that I placed the form in an empty project and build it as exe/comserver.
In the code of my other VFP exe:

PUBLIC lo as controle
lo = createobject('controle.controle')
lo.visible = .t.

In the taskmanager I can see the proces has started but no form is shown.
 

If you save your form as a class, do you instanciate the form in your main program?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
It's possible to have a form this way. Building an EXE com server is also the right way. But the _screen may not be visible and therefor you don't see your form.

You may try to put this into the init of the com form:
Code:
_screen.visible = .t.
Also play around with the form properties:
ShowWindow (2 - As Top Level Form)
Desktop (.T.)

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top