Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem creating an object
Message
From
16/11/2004 17:33:20
 
 
To
16/11/2004 15:30:33
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00961179
Message ID:
00961966
Views:
6
>To follow up on this thread, I will add the following:
>
>I did a simulation locally by creating a main EXE which calls a sub EXE. The sub EXE contains a class which contains some objects that are created from a class which is contained in the main EXE. When I run that locally, from an EXE mode, all works ok. The sub EXE is able to CREATEOBJECT() from a sub class contained in its project which is based on the main class contained in the main EXE.
>
>But, when I do the same in COM mode, the class cannot be seen. Basically, the sub class which is defined in the sub EXE cannot be created. However, if I CREATEOBJECT() directly into the main class from the sub EXE, that works as usual. I just can't find any logic for that problem as to know what is causing this.
>
>The only way that the sub EXE will succeed to create an instance of the sub class is if the main class is included and compiled in the sub EXE. But, that I don't want as it overloads the size of the sub EXE and causes me problems of synchronization as the main class will be read from the sub EXE instead of the main EXE.
>
>I understand the VFP project compiler will add a reference automatically at compile time to the main class in the project. That is ok. I can then check that class library to be excluded. However, this causes me problem at run time. I just can't create an instance of a sub class from the sub EXE.

Hi Michel,

I can't really follow what the problem is. But why not use NEWOBJECT() instead ? this function will not include the class into the project at compile time. I've succesfully called a class (in a form) from another exe using a code like this:
If (_VFP.StartMode == 0)   && 
   ** on development time, use MyClassName from MyClassLib.VCX from current dir
   This.NewObject( 'oObject', 'MyClassName', 'MyClassLib' )
else
   ** on run time, use MyClassName from MyClassLib.VCX from Another.exe
   This.NewObject( 'oObject', 'MyClassName', 'MyClassLib', 'Another.exe' )
endif
You can also try to use Preprocessor Directive (#IF..#ENDIF)

HTH
Herman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform