Calling a method on a different process

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Smith

    #1

    Calling a method on a different process

    Hello all,

    I am looking to call a method on a process - in fact another instance of the
    same application - once I have already determined it is running. Do I need
    to use remoting to achieve this or is there a simpler mechanism since it is
    on the same machine?

    Thanks in advance for any suggestions,
    Mike


  • Rob Tillie

    #2
    Re: Calling a method on a different process

    I think the best way is to use remoting, but there are other options like
    MSMQ I believe to communicate between AppDomains...

    Greetz,
    -- Rob.

    Mike Smith wrote:[color=blue]
    > Hello all,
    >
    > I am looking to call a method on a process - in fact another instance
    > of the same application - once I have already determined it is
    > running. Do I need to use remoting to achieve this or is there a
    > simpler mechanism since it is on the same machine?
    >
    > Thanks in advance for any suggestions,
    > Mike[/color]


    Comment

    • Mike Smith

      #3
      Re: Calling a method on a different process

      Would I be right in thinking though that this would invoke the method in the
      caller's process rather than in the called process? In my case I definitely
      need to affect the actions of the found process rather than simply use the
      method.

      Hope this makes sense,

      Mike

      "mk" <mk@nospam.co m> wrote in message
      news:00a801c35d be$737f0720$a10 1280a@phx.gbl.. .[color=blue]
      > If you have a reference to the assembly, you can
      > instantiate the class you need and call the method you
      > need. Given that it is another instance, you have all
      > the class structures available to you. For example (a is
      > the other process assembly):
      >
      >
      > object o = a.CreateInstanc e("YourAppName. CTargetClass");
      > CTargetClass ct = (CTargetClass)o ;
      > ct.TargetMethod ();
      >
      > HTH,
      >
      > MK
      >[color=green]
      > >-----Original Message-----
      > >Hello all,
      > >
      > >I am looking to call a method on a process - in fact[/color]
      > another instance of the[color=green]
      > >same application - once I have already determined it is[/color]
      > running. Do I need[color=green]
      > >to use remoting to achieve this or is there a simpler[/color]
      > mechanism since it is[color=green]
      > >on the same machine?
      > >
      > >Thanks in advance for any suggestions,
      > >Mike
      > >
      > >
      > >.
      > >[/color][/color]


      Comment

      • mk

        #4
        Re: Calling a method on a different process

        Check out .Net Remoting, Server Activated Objects, you'll
        be on the same machine so use BinaryFormattin g and TCP
        channels.

        HTH,

        mk
        [color=blue]
        >-----Original Message-----
        >Would I be right in thinking though that this would[/color]
        invoke the method in the[color=blue]
        >caller's process rather than in the called process? In[/color]
        my case I definitely[color=blue]
        >need to affect the actions of the found process rather[/color]
        than simply use the[color=blue]
        >method.
        >
        >Hope this makes sense,
        >
        >Mike
        >
        >"mk" <mk@nospam.co m> wrote in message
        >news:00a801c35 dbe$737f0720$a1 01280a@phx.gbl. ..[color=green]
        >> If you have a reference to the assembly, you can
        >> instantiate the class you need and call the method you
        >> need. Given that it is another instance, you have all
        >> the class structures available to you. For example (a[/color][/color]
        is[color=blue][color=green]
        >> the other process assembly):
        >>
        >>
        >> object o = a.CreateInstanc e[/color][/color]
        ("YourAppName.C TargetClass");[color=blue][color=green]
        >> CTargetClass ct = (CTargetClass)o ;
        >> ct.TargetMethod ();
        >>
        >> HTH,
        >>
        >> MK
        >>[color=darkred]
        >> >-----Original Message-----
        >> >Hello all,
        >> >
        >> >I am looking to call a method on a process - in fact[/color]
        >> another instance of the[color=darkred]
        >> >same application - once I have already determined it[/color][/color][/color]
        is[color=blue][color=green]
        >> running. Do I need[color=darkred]
        >> >to use remoting to achieve this or is there a simpler[/color]
        >> mechanism since it is[color=darkred]
        >> >on the same machine?
        >> >
        >> >Thanks in advance for any suggestions,
        >> >Mike
        >> >
        >> >
        >> >.
        >> >[/color][/color]
        >
        >
        >.
        >[/color]

        Comment

        Working...