Valhalla Legends Forums Archive | Battle.net Bot Development | [VB6] DLL That stays open?

AuthorMessageTime
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
December 19, 2004, 8:09 PM
Arta
I believe windows does that for you.
December 19, 2004, 8:55 PM
NetNX
no because its creating multiple instances of the same dll...
December 19, 2004, 9:04 PM
Arta
What is?
December 19, 2004, 9:39 PM
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?
December 19, 2004, 10:12 PM
Myndfyr
[quote author=iago link=topic=9959.msg92966#msg92966 date=1103494340]
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?
[/quote]

You'd probably need to set up some kind of remote procedure call.
December 19, 2004, 11:58 PM
OnlyMeat
[quote author=NetNX link=topic=9959.msg92954#msg92954 date=1103486992]
:) 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
[/quote]

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.
December 20, 2004, 7:40 AM
NetNX
thank you i will look into that ~_^
December 20, 2004, 1:10 PM
Adron
Perhaps an out-of-process ole server would work?
December 20, 2004, 5:15 PM
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?
December 20, 2004, 5:21 PM
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
January 28, 2005, 3:31 PM

Search