Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Is it possible to share objects (Managed code c#) across applications?

Is it possible to share objects (Managed code c#) across applications?

Scheduled Pinned Locked Moved C#
csharpquestion
11 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Diana Fernandez

    Thanks, Diana.

    A Offline
    A Offline
    andre_swnpl
    wrote on last edited by
    #2

    yes. make the object public and add a refernece. :)

    U 1 Reply Last reply
    0
    • A andre_swnpl

      yes. make the object public and add a refernece. :)

      U Offline
      U Offline
      Uwe Keim
      wrote on last edited by
      #3

      Nonsense! You cannot make an "object" public, you can make a "class" public. What she is looking for is called "IPC" - Inter Process Communication. Take a Google search for it [^].

      -- Try our Windows-based CMS: www.zeta-producer.com Try our ticket helpdesk system: www.zeta-helpdesk.com See me working: www.magerquark.com

      1 Reply Last reply
      0
      • D Diana Fernandez

        Thanks, Diana.

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #4

        You need to provide more info.  Do you want to pass an instance of an object between apps, or do you want to create a class, and use instances of that class in different apps ? Or something else ?

        Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

        D 1 Reply Last reply
        0
        • D Diana Fernandez

          Thanks, Diana.

          R Offline
          R Offline
          Russell Jones
          wrote on last edited by
          #5

          Are your applications all on the same machine? You might want to try Enterprise Services. .Net remoting also works well and you can setup singleton objects which would be shared by all connecting clients. Services are useful if you want highly persistent objects. maybe combined with one of the methods above. Persisting the objects to an XML file or database might work if your design is very simple. As always the solution depends on what you are trying to achieve. HTH Russ

          D 1 Reply Last reply
          0
          • C Christian Graus

            You need to provide more info.  Do you want to pass an instance of an object between apps, or do you want to create a class, and use instances of that class in different apps ? Or something else ?

            Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

            D Offline
            D Offline
            Diana Fernandez
            wrote on last edited by
            #6

            Hi Christians, There is one application which is developed totally on c#. At runtime I want to make use of one of the objects of these application from another application that too is developed in c#. But in the first application I cannot make any modification or the channel informations are not available otherwise I could have used remoting. There is a method "GetActiveObject" but it is working only for unmanaged objects (I think). Is there any method equivalet to this which can give the referece of the active or running objects? Thanks Diana.

            C 1 Reply Last reply
            0
            • R Russell Jones

              Are your applications all on the same machine? You might want to try Enterprise Services. .Net remoting also works well and you can setup singleton objects which would be shared by all connecting clients. Services are useful if you want highly persistent objects. maybe combined with one of the methods above. Persisting the objects to an XML file or database might work if your design is very simple. As always the solution depends on what you are trying to achieve. HTH Russ

              D Offline
              D Offline
              Diana Fernandez
              wrote on last edited by
              #7

              Hi Russ, Bothe applications are running on the same machine. As I don't know the channel informations, I cannot use remoting as well as I cannot modify the application. I would like to know is there any method similar to "GetActiveObject" available for this? Thanks Diana.

              1 Reply Last reply
              0
              • D Diana Fernandez

                Hi Christians, There is one application which is developed totally on c#. At runtime I want to make use of one of the objects of these application from another application that too is developed in c#. But in the first application I cannot make any modification or the channel informations are not available otherwise I could have used remoting. There is a method "GetActiveObject" but it is working only for unmanaged objects (I think). Is there any method equivalet to this which can give the referece of the active or running objects? Thanks Diana.

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #8

                OK, you want to access an object, an instance of a class, inside another app ? You really cannot.  If you can't change the program, there is absolutely no way you can pull an object out of it.  The other program needs to anticipate and respond to your attempts to communicate.

                Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                D 2 Replies Last reply
                0
                • C Christian Graus

                  OK, you want to access an object, an instance of a class, inside another app ? You really cannot.  If you can't change the program, there is absolutely no way you can pull an object out of it.  The other program needs to anticipate and respond to your attempts to communicate.

                  Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                  D Offline
                  D Offline
                  Diana Fernandez
                  wrote on last edited by
                  #9

                  Ok, Thanks. But how is it possible with "GetActiveObject" method for unmanaged objects? Diana.

                  C 1 Reply Last reply
                  0
                  • D Diana Fernandez

                    Ok, Thanks. But how is it possible with "GetActiveObject" method for unmanaged objects? Diana.

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #10

                    I've never used them, but it looks to me like they work with COM objects.  A COM object has a defined public interface, the author has already defined a method to interact with an external program.

                    Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                    1 Reply Last reply
                    0
                    • C Christian Graus

                      OK, you want to access an object, an instance of a class, inside another app ? You really cannot.  If you can't change the program, there is absolutely no way you can pull an object out of it.  The other program needs to anticipate and respond to your attempts to communicate.

                      Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                      D Offline
                      D Offline
                      Diana Fernandez
                      wrote on last edited by
                      #11

                      FYI... It is possible to attach a dll into a process from a different process and invoke a static method available with that dll. So it is possible to enter into a process and do whatever there, though we can't access the data back to the attaching process. If interested to know more see the article ".NET Object Spy and InvokeRemote". Thanks Diana.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups