|
-
Jun 28th, 2001, 01:10 AM
#1
Thread Starter
Member
Public variable in ActiveX DLL project
I have an application with 2 projects: an exe and an ActiveX DLL project.
The DLL contains some classes and is ‘Single threaded apartment’.
The module section of DLL contains a public variable vp1 (integer)
The EXE program instantiates an object in DLL program and call a method that set the vp1 variable.
Then the EXE program instantiate another object in DLL program and call a method that show the value of vp1.
But I don’t see the value already set with the first object: vp1 variable isn’t public for all classes from DLL project.
Why ?
I mention that these things happen when I run the exe file of the EXE project. When I run the Project from IDE, the second class shows the right value for the public variable.
-
Jun 28th, 2001, 03:03 AM
#2
Thread Starter
Member
I have to add some words about EXE project:
It is a form. In the load event I instantiate an object in DLL program and call a method that set the
vp1 variable.
In the Click event of a button I instantiate another object in DLL program and call a method that show
the value of vp1. I cannot get the value allready set.
If I instantiate both objects in the same procedure (in load event of the form) I can get the correct
value for vp1 when I call the method of the second object.
-
Jun 29th, 2001, 06:40 PM
#3
In general, you are trying to violate basic COM rules -
encapsulation in this case. Don't do it, not because of purist reasons, but because it won't work reliably as already you see, I'm not going into why it won't work. Just don't do it.
If you need communication between your activex .exe and your process try:
named pipes or mailslots for remote nodes
environment variables
use sendmessage to send the value to the regular .exe window, intercept the message by sublassing.
-
Jul 2nd, 2001, 05:01 AM
#4
Thread Starter
Member
-
Aug 16th, 2001, 10:11 AM
#5
I disagree using an activex EXE I share variables across multiple applications. I have a multiuse connection class that accesses a Public Not creatable class like the coffee example and it works great. I use it for user log in for a set of apps that way if you log in once you don't have to keep logging in after that it just checks to see if you are already logged in and uses that info. It works like a local Passport type system.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|