Using Global Objects 
Author Message
 Using Global Objects

Hello,

I am using a global object in a vb project. Everything was working fine until I
compiled the dll and registered it in COM+. Here is the situation.

The Global Object is DIMensioned in a common code module (Not a class module)
Global gobjClass as Dll.GlobalClass
The Global Object is Instantiated within a "Wrapper" Class module for the project.
(Set GlobalObj = CreateObject("Dll.GlobalClass"))
Other class modules access the global object on a regular basis.

In debug mode and before using COM+ with the Project Component, everything works
fine. I am able to access the methods of that class module from other class
modules even though it was only instantiated once within the "Wrapper" Class.

Once I register it in COM+, I get an error when trying to access any method of
that global class. It instantiates it fine, but other class modules cannot access
it outside of the class that instantiated it.

I think that I have pretty much exhausted MSDN looking for a solution.

Any tips or suggestions would be greatly appreciated.

Thanks,

Ed



Tue, 26 Aug 2003 05:46:29 GMT  
 Using Global Objects
You may be creating the other classes that wish to use the global object from
within either the instantiating class, or one lower on the call stack, using
createobject.  When using createobject to create an internal class (one within
the same .dll) the results act like you created an external object (i.e. you may
not be able to access global var's or friend functions in the dll's .bas
modules).  The solution, in most cases is as simple as using the "new" keyword
instead of createobject, and the child class will be created in the same context.

Also, could be...if the client application (outside the .dll) is creating the
object which instantiates the global object, and ALSO the client application
creates an object of a different class within the global's .dll; Then the two
objects will be on different instances of the class. This can be solved with the
STATIC keyword

Post a response to let me know if this helps.

Quote:
-----Original Message-----

Hello,

I am using a global object in a vb project. Everything was working fine until I
compiled the dll and registered it in COM+. Here is the situation.

The Global Object is DIMensioned in a common code module (Not a class module)
Global gobjClass as Dll.GlobalClass
The Global Object is Instantiated within a "Wrapper" Class module for the project.
(Set GlobalObj = CreateObject("Dll.GlobalClass"))
Other class modules access the global object on a regular basis.

In debug mode and before using COM+ with the Project Component, everything works
fine. I am able to access the methods of that class module from other class
modules even though it was only instantiated once within the "Wrapper" Class.

Once I register it in COM+, I get an error when trying to access any method of
that global class. It instantiates it fine, but other class modules cannot access
it outside of the class that instantiated it.

I think that I have pretty much exhausted MSDN looking for a solution.

Any tips or suggestions would be greatly appreciated.

Thanks,

Ed
.



Sat, 30 Aug 2003 02:27:38 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using Global objects

2. Using Global objects

3. Global Variables / Global Objects

4. Global objects using VB, MTS - looking for comments

5. Access Forms collection, App object or Global object of the Parent application

6. Global Modules-startup-429,activeX component can't create object

7. Global Address Book enrtry and CDO object properties

8. need to register global Application object With Events from AddIn

9. dotnet Reference to non-shared member requires object reference - Global.asax.vb

10. Global Object

11. global object

12. Creating Com Object in Global.asa

 

 
Powered by phpBB® Forum Software