Discussion:
CLASS - Sharing
(too old to reply)
Wilson Thomas
2004-08-19 08:11:25 UTC
Permalink
Friends,

I had some problem with splitting exe and that is solved. Thanks for all
those responded.
Current setup is like this

main.exe - all program and OLE public classe objects and connection strings
forms.exe - all forms
reports.exe - all reports

Since report is only using connection string declared public in main.exe,
all reports are working fine. Connection string is only defined in Main.exe

But in forms.exe, some forms using classes objects (like standard forms and
some utility screens) that are in main.exe and checked as OLE public. These
form showing error as it cannot locate class library.

Any idea to share class objects across programs?

Wilson Thomas
Olaf Doschke
2004-08-19 09:31:02 UTC
Permalink
Post by Wilson Thomas
But in forms.exe, some forms using classes objects (like standard forms and
some utility screens) that are in main.exe and checked as OLE public. These
form showing error as it cannot locate class library.
For OLE public classes, you mustn't know the class library,
OLE public classes are normally registered COM-Servers
and can be instanciated like Excel with
CREATEOBJECT("mycomserver.myclass")
See Project Info on the Tab "Servers".

The registry normally then knows where that class is.
The registry is automatically filled with the needed info
on the computer you compile the exe that contains the
ole public class(es). If you move the exe to another
folder or another computer you have to register the
exe again with regsvr32!

But OLE public is perhaps not what you intended.
It makes a class somewhat public, but OLE public,
not the same as public variables. It can be used for
interoperability with other OLE capable languages
and applilcations, eg you could instanciate your
OLE public class within Excel-Makros. Lookup
automation servers in the help for details on that.

You can instanciate a class within any Fox.exe or
app with NEWOBJECT, which has the needed
parameters. And that can also be "normal" foxpro
classes.

In your case:
loObject = NEWOBJECT("<YourClass>",;
"<SomeVCXwithinMainEXEContaining<YourClass>>",;
"<path>main.exe", <InitParameters...>)

Bye, Olaf.

Loading...