sharing dlls

Hi guys,

Just to see if we can do it, we are trying to get two pc's to share a dll, but not just the functions, the data contained therein.

ie each pc has a little bouncing ball program which consults a dll to find the position of the ball and where it goes next. At present the dll is giving two seperate results to each pc rather than keeping one constant result that applies to each pc. Any ideas ?
ntollfreeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mcriderConnect With a Mentor Commented:
I think you're going to have to go about this a different way...

The way your're doing it now, each program on each machine has it's own program address space... This is why the balls bounce in different directions.

You're going to have to think about a "client-server" implementation where one of the PCs is the client and the other is the server...

The client would then get the ball coordinates and bounce direction from the server...  Even then, there will be some "lag time" because of the time required to pass the information across the network (although it may not be noticeable.) Good-luck!


Cheers!
0
 
HATCHETCommented:
Are both PC's configured identically?  You have to take into consideration that if the display settings are set differently, the results will probibly be different.  (i.e. - Different pixels/in, different system font sizes, different resolutions, etc.)
0
 
ntollfreeAuthor Commented:
Yep, both are identical, even down to the make of the monitor.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Éric MoreauSenior .Net ConsultantCommented:
You have to make it as an ActiveX EXE (not DLL) and properties that you want to be shared must be placed in a standard module (not in a class).
0
 
ntollfreeAuthor Commented:
Nope, we've tried that and still the balls bounce in different directions on each pc. thanks though
0
 
Éric MoreauSenior .Net ConsultantCommented:
I am sure that my comment is good since I use it (not for bouncing balls) in multiple projects.

-First, I write an ActiveX EXE.
-In this project, I add a standard module.
-In this standard module I add public properties. Properties in a standard module of an ActiveX EXE are shared for all instances. Properties in a class module are private to the instance.

Now you can have 2 or more applications accessing this component and they will have the same properties since it is in a standard module.

0
 
mcriderCommented:
emoreau,

Your answer works for applications on the same system, but if you read the question, you find that there are 2 PCs involved...

The only way to do it with 2 or more PCs in a client-server environment...



ntollfree,

If my comments help you, please accept the comment as an answer...


Cheers!
0
 
Éric MoreauSenior .Net ConsultantCommented:
Your ActiveX EXE can be placed on a server.

Your application ca use the CreateObject statement to create your instances. If you look carefully, the second parameter of CreateObject is the server name!

0
 
mcriderCommented:
This is a direct quote from the VB5 CreateObject Help page... There is no reference to a secon argument for server name....



CreateObject Function

   Creates and returns a reference to an ActiveX object.

Syntax

   CreateObject(class)

The class argument uses the syntax appname.objecttype and has these parts:

Part      Description
appname      Required; Variant (String). The name of the application providing the object.
objecttype      Required; Variant (String). The type or class of object to create.



Cheers!
0
 
Éric MoreauSenior .Net ConsultantCommented:
The second parameter to the CreateObject statement was added to VB6 so it is perfectly normal that you don't see it in VB5.
0
 
tommy_boyCommented:
Wrong, the object will have to be a DCOM object not a COM object.  Compiled in the similar way, but it must be running on a server.  Provides one interface (server) for multiple dependants (clients).

Use VB6 though.

Nt and 98 comes with DCOM, otherwise you will need DCOM 95 for 95 machines.

Look at support.mircrosoft.com for more info and examples of DCOM.

Cheers!
0
 
ntollfreeAuthor Commented:
Sorry, should have stated are running VB5....this probably is going to pan out to be too much effort and I'm going to end up playing space invaders instead but if we do get our fingers out and do it, we'll probably use the client/server thing from mcrider so points go to there.....


.....several hours later, dear EE, how do I get past the third level on Space Invaders.
0
 
ntollfreeAuthor Commented:
cheers
0
 
mcriderCommented:
Thanks for the points! Glad I could help!

I'm a Backgammon player myself.... ;-)

Cheers!
0
All Courses

From novice to tech pro — start learning today.