Reference to an external object/application

This is a discussion on Reference to an external object/application within the C++ Programming forums, part of the General Programming Boards category; Hey, I'm trying to write a script to run in program 1 that will pull information from program 2, but ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    4

    Reference to an external object/application

    Hey,

    I'm trying to write a script to run in program 1 that will pull information from program 2, but I can't figure out how to access program 2. The information I have on writing external scripts/applications for program 2 is:

    In order to work with MediaMonkey’s objects from outside a MediaMonkey script, you need to create a reference to the SDB object (an instance of the SDBApplication class) yourself. For external applications, make sure that you have added a reference to the SongsDB library, first.
    and the example they give is:
    Code:
    SongsDB::SDBApplication^ SDB = gcnew SongsDB::SDBApplication();
     
    SDB->ShutdownAfterDisconnect = false;    // in case you want to keep an opened instance open after disconnecting the SDB object
    I tried putting the example code into my main function, which of course didn't work but I have no idea on what I'm doing. Any help is much appreciated.

    Thanks,

    redmaw

  2. #2
    Registered User
    Join Date
    Aug 2010
    Posts
    13
    You can inject a dll into program two and read data from there, or you can send data with Winsock between the two applications. Or you can make program two write to a file, and program one reads data from that file and displays the information. So many ways.

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    4
    Thanks iPromise. Winsock looks like what I need, although I'm thinking of trying a different language as friend suggested now.

  4. #4
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    903
    Do modern operating systems allow for a mode where a particular program can have full read access to memory? This way I could check the status of one of my simulations without overhead. Well, maybe.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,625
    You cannot access physical memory unless you are in the kernel. And this isn't C++. Just a FYI.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    There are many ways to do this. This list assumes you are on a Windows OS:

    • Mailslots (essentially a buffer of data that both processes can access)
    • A shared file
    • A shared port (process A broadcasts data over a port and process B receives it via the port)
    • Pipes (read more about this in the Windows SDK) - very simple
    • DLL injection

    I've done all of these and I prefer to stay away from DLL injection b/c there are so many other elegant ways available to use. However there are things that DLL injection can do that the other methods cannot but based on your post you will not need this functionality.

  7. #7
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    903
    Mailslots, eh? I'll look into that. Thanks Elysia and Bubba.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  3. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21