CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2000
    Posts
    71

    How can I communicate with other applications

    Hello everybody,

    I've got a small (or bigger) problem. I need to return a value from my application to a application which calls my program. My program should do something and should return a numeric value to the calling application. I've found no way to return a value out of the EXE-file. Could somebody help me with this. Thanks a lot

    Michael Hartmann


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: How can I communicate with other applications

    several solutions to this:
    - turn your called program into an ActiveX Exe and add a public class module with a public function.

    - if you only need to "return" a single value, use the SendMessage API and subclass the form window to get access to that message

    - use the ExitProcess API in your called app and access the return value via GetExitCodeProcess API

    - use a file to exchange data

    - use DDE (dynamic data exchange)
    ...


  3. #3
    Join Date
    Feb 2000
    Posts
    71

    Re: How can I communicate with other applications

    I've tryed it with the ExitProcess API, but it doesn't work. I write the following code:

    Private Sub mnuFileExit_Click()
    ExitProcess(5)
    End
    End Sub

    I called the EXE form a Batchfile with start /w EXENAME and checked the errorlevel after exiting the application. The errorlevel is zero. Then I wrote a very small program with a standard form, add one Button (Exit) and wrote the following code into the Click handling routine:

    Private Sub cmdEnd_Click()
    ExitProcess(5)
    End
    End Sub

    I called the EXE also from a batchfile and this work. Maybe the problem with my big projekt is, that it uses several OCX and DLL files.

    I hope somebody could help me

    Best regards

    Michael Hartmann



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured