Share variables or properties of an object between programs 
Author Message
 Share variables or properties of an object between programs

no, you can't, because dll objects have one variable set for each thread

you have to use an ActiveX EXE (which live in a separate process) with a
multiuse class, so
that every instance of the class lives in the same process. Then declare
some global variables
in a standard module.
In order to ensure all objects to live in the same thread you must have, in
the General tab
of project properties, Threading model set to 'Thread pool' with '1' in the
text box



Quote:
> I need to share data between programs. Is it possible to create a dll with
> an object in it that I can set properties or variables in and see it from
> more than 1 program?

> Any tips are really appreciated.

> Tommy



Tue, 07 Sep 2004 16:27:12 GMT  
 Share variables or properties of an object between programs
One method is to use an AX EXE

- different Apps can create instances of the 'exposed' class(es)

- however variables in a .BAS module within the AX EXE are effectively
shared



Quote:
>I need to share data between programs. Is it possible to create a dll with
>an object in it that I can set properties or variables in and see it from
>more than 1 program?

>Any tips are really appreciated.

>Tommy



Tue, 07 Sep 2004 17:03:24 GMT  
 Share variables or properties of an object between programs
I have tried this. I am not getting seeing the variable. I can create the
object in the ax exe. I wrote a routine in the ax exe cls module to read and
set the public variable but it always comes back empty from the other
program.

I must be doing something wrong. In my main I am creating the object. Is
this correct? Any ideas what I may be doing wrong?

Thanks in advance.

Tommy


Quote:
> no, you can't, because dll objects have one variable set for each thread

> you have to use an ActiveX EXE (which live in a separate process) with a
> multiuse class, so
> that every instance of the class lives in the same process. Then declare
> some global variables
> in a standard module.
> In order to ensure all objects to live in the same thread you must have,
in
> the General tab
> of project properties, Threading model set to 'Thread pool' with '1' in
the
> text box



> > I need to share data between programs. Is it possible to create a dll
with
> > an object in it that I can set properties or variables in and see it
from
> > more than 1 program?

> > Any tips are really appreciated.

> > Tommy



Wed, 15 Sep 2004 00:47:24 GMT  
 Share variables or properties of an object between programs
In the .BAS module Dim the variables as Private

Then Call a procedure from the exposed class(es) to get/set these
variables.

You could simply Dim the variables as Public and access them from the
exposed Class(es) - but IMO that is not really good practice.

BTW the exposed Class's Instancing Property needs to be set to 5 -
Multiuse

5  MultiUse. Allows other applications to create objects from the
class. One instance of your component can provide any number of
objects created in this fashion.

On Fri, 29 Mar 2002 10:47:24 -0600, "Tommy Martin"

Quote:

>I have tried this. I am not getting seeing the variable. I can create the
>object in the ax exe. I wrote a routine in the ax exe cls module to read and
>set the public variable but it always comes back empty from the other
>program.

>I must be doing something wrong. In my main I am creating the object. Is
>this correct? Any ideas what I may be doing wrong?

>Thanks in advance.

>Tommy



>> no, you can't, because dll objects have one variable set for each thread

>> you have to use an ActiveX EXE (which live in a separate process) with a
>> multiuse class, so
>> that every instance of the class lives in the same process. Then declare
>> some global variables
>> in a standard module.
>> In order to ensure all objects to live in the same thread you must have,
>in
>> the General tab
>> of project properties, Threading model set to 'Thread pool' with '1' in
>the
>> text box



>> > I need to share data between programs. Is it possible to create a dll
>with
>> > an object in it that I can set properties or variables in and see it
>from
>> > more than 1 program?

>> > Any tips are really appreciated.

>> > Tommy



Wed, 15 Sep 2004 17:23:15 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. *HELP* ..Sharing variables between program

2. How to pass vbscript array variable to shared object using ByRef

3. Object variable sharing

4. ENUM Properties of Object Variable

5. Object variable not set, OK inside Property Let

6. Programmed access to object properties

7. Error msg: Object variable or With block variable not set

8. converting an object variable (name of a file) into a string variable

9. Object Variable With Variable Not Defined Error

10. Object variable or With block variable not set when calling COM Dll

11. Manipulating variables/objects with variables

12. Object variable or With block variable not set (Error 91)

 

 
Powered by phpBB® Forum Software