• Welcome to Valhalla Legends Archive.
 

[VB6] DLL That stays open?

Started by NetNX, December 19, 2004, 02:09 PM

Previous topic - Next topic

NetNX

 :) just thought id ask the pro's

In visual basic when i call a dll it opens for the program i called it on i want the same instance of the dll to load for another program with the variables the same is this possible or is there a better method i could go about doing this?

Example
Start.exe loads console.dll
Start2.exe loads another console.dll i just want 1 shared console

Arta

I believe windows does that for you.

NetNX

no because its creating multiple instances of the same dll...

Arta


iago

The memory used by the DLL will technically be shared, but any stored data will not be shared.

I think he's looking for something like Linux's shared memory, where more than one process can share memory with each other.  I'm not sure how to do that on Windows, but is that what you want to do?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


MyndFyre

Quote from: iago on December 19, 2004, 04:12 PM
The memory used by the DLL will technically be shared, but any stored data will not be shared.

I think he's looking for something like Linux's shared memory, where more than one process can share memory with each other.  I'm not sure how to do that on Windows, but is that what you want to do?

You'd probably need to set up some kind of remote procedure call.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

OnlyMeat

Quote from: NetNX on December 19, 2004, 02:09 PM
:) just thought id ask the pro's

In visual basic when i call a dll it opens for the program i called it on i want the same instance of the dll to load for another program with the variables the same is this possible or is there a better method i could go about doing this?

Example
Start.exe loads console.dll
Start2.exe loads another console.dll i just want 1 shared console

Each processes dll will have it's own instance data, to share data across multiple processes you would need to use IPC ( interprocess communication ), there are a few ways to go about this but the easiest by far is WM_COPYDATA which marshals pointers across process boundries for you.

WM_COPYDATA is simply a standard windows message that you can send to another window, using this you can pass a pointer of your instance specific data to another process.

IIRC you use the LPARAM parameter as your pointer.

See MSDN for futher information on how to implement this.

NetNX

thank you i will look into that ~_^

Adron

Perhaps an out-of-process ole server would work?

Eibro

The simplest solution is to create a shared data segment in the said dll...

#pragma data_seg( "SHARED" )

int myVariableSharedAmongMultipleExes;

#pragma data_seg()

Not sure if that is possible in VB6 (I doubt it). If not, then why not create the DLL in C and executable in VB6?
Eibro of Yeti Lovers.

NetNX

My C Knolege is limited maybe i can write the plugin in VB and then Write a plugin to load that plugin in C as an array then make that C Plugin shared and load said C plugin from VB