Interaction between 2 programs ??

Hi Experts,

I have the following situation:

Program A will start program B, if I click a button Program B will do something, but also program A must get a value send by the button of program B.

If it is possible then I like have the posibility to start program B also form Program C or D.
In that case the information must be send to C or D instead of A.

Question:
1. Is it possible to let program B to findout by what program it was started, (or what the last active program or form within a program was).?
2. Is it possible to send information to this program to specific control or variable?

Thanks
Murph
LVL 17
MurpheyApplication ConsultantAsked:
Who is Participating?
 
RogueSolutionsCommented:
In that case you have to open the VB project for program B and goto to the Project menu and select "Program B" properties at the bottom.

Switch the dropdown from Standard EXE to ActiveX DLL.

You'll now need to change the program's design so that it's features are 'exposed' as classes.  These classes are then what trigger the various functionality/forms/etc. that Program B needs to perform.

When you compile your new Prog B it will register itself (on your PC) and you can then create a Reference to it from Prog A, C, D, etc.

---

You'll need to go find help/books on how to create and work with DLL's.  Not something that can really be covered in detail here.
0
 
Marv-inCommented:
all of this is posible, but what is the reason you need to split between different programs?
0
 
koolnurdCommented:
Hi murphey2  

Why dont you use winsock and send a message to the programme B when you call it from A. this could have a specific no which recognise the source of the calling programme.

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
MurpheyApplication ConsultantAuthor Commented:
Hi Marv-in,

I like to split up the program, because program B will be used in at least 3 other programs and maybe more programs in the future, but if there ia an other way........

About winsock.... yeah... don't know how to use that,
0
 
RogueSolutionsCommented:
If program B is needed by other programs then you want to make it as an ActiveX DLL file.  Programs A, C, D, etc have a reference to B and can call it's methods, set properties, display forms, etc.
0
 
Marv-inCommented:
if its across a network - winsock is the way to go
if its not then activex is the way to go

if you have a common database use it for passing information

you could also use command line parameters the shell function but thats a little sloppy and not as secure depending on what you are doing

0
 
MurpheyApplication ConsultantAuthor Commented:
Sounds realy good !!!!


How can I create an ActiveX.DLL File from an application


0
 
RogueSolutionsCommented:

Is Program B already an application and do you have the source code for it?

0
 
MurpheyApplication ConsultantAuthor Commented:
Yeah, Prog B is an application and Yeah I have the source code of it.

On this moment Application B is writing some stuf to a .txt file this file wat is read by Application A. This was not my idea,
it worked that way and because I have to write Prog C I like to change A and B to get a better interface.
0
 
MurpheyApplication ConsultantAuthor Commented:
Sounds simple but.....

"features are 'exposed' as classes"

Can I find something on the web about that?

Regards,
Murph


0
 
RogueSolutionsCommented:

    "Can I find something on the web about that?"

The answer to that is always Yes!  

I don't have any handy links though, sorry.  
0
 
Marv-inCommented:
You could take sort of a plugin aproach. In an activex dll you can have classes and forms. You only need one class defined as public [this is the one used to create the interface] and the rest can be private and interact witht the form.

Take a look at these 2 examples. They are very good templates to create a simple plugin interface

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=12319&lngWId=1
http://www.codeguru.com/vb/gen/vb_misc/plugins/article.php/c5605/
0
 
MurpheyApplication ConsultantAuthor Commented:
I looked to the two examples, but I don't understand a word from it !!!!!!

I will ask someone to solve thif for me, I don't have much time to finish this

Thanks I will split the points


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.