Interprocess Communication

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Norman

    Interprocess Communication

    I'm trying to pas data back and forth between a vb app, and a c++ app.
    I have tried several methods:

    Through a dll (written in C++), doesn't work because each app has it's
    own instances of the variables declared in the dll. Is there a way to
    force one instance?

    Windows messaging - I could only get it working by broadcast, then it
    calls Internet Explorer, and wierd stuff happens.

    FileMapping - I'm working on this method now, having trouble with some
    of the api's in C.

    Can anyone offer any suggestions?

    Thanks in Advance

    John Norman
  • Stephane Richard

    #2
    Re: Interprocess Communication

    Through a dll (written in C++), doesn't work because each app has it's
    own instances of the variables declared in the dll. Is there a way to
    force one instance?

    To this....the API would let you search for an existing instance of the
    object and use that one instead of creating a new instance

    --
    Stéphane Richard
    Senior Software and Technology Supervisor

    For all your hosting and related needs
    "John Norman" <reply@throughn ewsgrp.com> wrote in message
    news:je4kgvs90p kuluqpqu0bdnelc qt9mcuqni@4ax.c om...[color=blue]
    > I'm trying to pas data back and forth between a vb app, and a c++ app.
    > I have tried several methods:
    >
    > Through a dll (written in C++), doesn't work because each app has it's
    > own instances of the variables declared in the dll. Is there a way to
    > force one instance?
    >
    > Windows messaging - I could only get it working by broadcast, then it
    > calls Internet Explorer, and wierd stuff happens.
    >
    > FileMapping - I'm working on this method now, having trouble with some
    > of the api's in C.
    >
    > Can anyone offer any suggestions?
    >
    > Thanks in Advance
    >
    > John Norman[/color]


    Comment

    • J French

      #3
      Re: Interprocess Communication

      Ok,
      since you have full control of the CPP DLL and the VB App,
      - this is how I do it

      1) RegisterWindows Message using a unique string ID
      - that gives you a 'unique' Windows Message Number
      2) Broadcast on this number, and make all recipients reply
      - sending back their hWnds
      3) SendMessage using WM_COPYDATA to then now known hWnd(s)

      If you can understand Delphi / Pascal then I could post you an example
      that 'chats' - or a DLL that encapsulates it

      On Mon, 07 Jul 2003 17:40:54 -0700, John Norman
      <reply@throughn ewsgrp.com> wrote:
      [color=blue]
      >I'm trying to pas data back and forth between a vb app, and a c++ app.
      >I have tried several methods:
      >
      >Through a dll (written in C++), doesn't work because each app has it's
      >own instances of the variables declared in the dll. Is there a way to
      >force one instance?
      >
      >Windows messaging - I could only get it working by broadcast, then it
      >calls Internet Explorer, and wierd stuff happens.
      >
      >FileMapping - I'm working on this method now, having trouble with some
      >of the api's in C.
      >
      >Can anyone offer any suggestions?
      >
      >Thanks in Advance
      >
      >John Norman[/color]

      Comment

      • Asperamanca

        #4
        Re: Interprocess Communication

        John Norman <reply@throughn ewsgrp.com> wrote in message news:<je4kgvs90 pkuluqpqu0bdnel cqt9mcuqni@4ax. com>...[color=blue]
        > I'm trying to pas data back and forth between a vb app, and a c++ app.
        > I have tried several methods:
        >
        > Through a dll (written in C++), doesn't work because each app has it's
        > own instances of the variables declared in the dll. Is there a way to
        > force one instance?
        >
        > Windows messaging - I could only get it working by broadcast, then it
        > calls Internet Explorer, and wierd stuff happens.
        >
        > FileMapping - I'm working on this method now, having trouble with some
        > of the api's in C.
        >
        > Can anyone offer any suggestions?
        >
        > Thanks in Advance
        >
        > John Norman[/color]

        A pretty complete documentation on how to pass data between processes
        can be found at the following URL:


        Robert

        Comment

        • John Norman

          #5
          Re: Interprocess Communication

          Stephane,
          Do you know which api's handle this?

          Thanks
          John

          On Tue, 08 Jul 2003 00:57:08 GMT, "Stephane Richard"
          <stephane.richa rd@verizon.net> wrote:
          [color=blue]
          >Through a dll (written in C++), doesn't work because each app has it's
          >own instances of the variables declared in the dll. Is there a way to
          >force one instance?
          >
          >To this....the API would let you search for an existing instance of the
          >object and use that one instead of creating a new instance[/color]

          Comment

          • J French

            #6
            Re: Interprocess Communication

            This is a complete red herring

            DLLs leech of the Data Area of their parent EXEs
            - although they all share the same Code Area, they all have different
            Data Areas - if they belong to different EXEs

            There is just one curious exception, which seems to be memory mapped
            files - I still have not got to the bottom of that.

            Passing data between VB Apps (not VB to CPP) is pretty easy, you
            simply use an AX EXE
            - which _does_ have its own Data Area
            - and hence that is 'shared' between anything using the EXE
            (providing the instancing of the AX EXE has been correctly set up)

            This is probably of little use for Inter-Language and App
            communication - but nifty for VB to VB

            On Tue, 08 Jul 2003 05:32:14 -0700, John Norman
            <reply@throughn ewsgrp.com> wrote:
            [color=blue]
            >Stephane,
            > Do you know which api's handle this?
            >
            >Thanks
            >John
            >
            >On Tue, 08 Jul 2003 00:57:08 GMT, "Stephane Richard"
            ><stephane.rich ard@verizon.net > wrote:
            >[color=green]
            >>Through a dll (written in C++), doesn't work because each app has it's
            >>own instances of the variables declared in the dll. Is there a way to
            >>force one instance?
            >>
            >>To this....the API would let you search for an existing instance of the
            >>object and use that one instead of creating a new instance[/color]
            >[/color]

            Comment

            Working...