Solved

Interaction between 2 programs ??

Posted on 2004-11-01
169 Views
Last Modified: 2013-11-13
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
0
Question by:theo kouwenhoven
    13 Comments
     
    LVL 6

    Expert Comment

    by:Marv-in
    all of this is posible, but what is the reason you need to split between different programs?
    0
     
    LVL 2

    Expert Comment

    by:koolnurd
    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
     
    LVL 16

    Author Comment

    by:theo kouwenhoven
    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
     
    LVL 5

    Expert Comment

    by:RogueSolutions
    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
     
    LVL 6

    Expert Comment

    by:Marv-in
    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
     
    LVL 16

    Author Comment

    by:theo kouwenhoven
    Sounds realy good !!!!


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


    0
     
    LVL 5

    Expert Comment

    by:RogueSolutions

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

    0
     
    LVL 16

    Author Comment

    by:theo kouwenhoven
    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
     
    LVL 5

    Accepted Solution

    by:
    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
     
    LVL 16

    Author Comment

    by:theo kouwenhoven
    Sounds simple but.....

    "features are 'exposed' as classes"

    Can I find something on the web about that?

    Regards,
    Murph


    0
     
    LVL 5

    Expert Comment

    by:RogueSolutions

        "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
     
    LVL 6

    Assisted Solution

    by:Marv-in
    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
     
    LVL 16

    Author Comment

    by:theo kouwenhoven
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now