Click to See Complete Forum and Search --> : How can I communicate with other applications


Michael Hartmann
February 7th, 2000, 07:30 AM
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

Lothar Haensler
February 7th, 2000, 07:46 AM
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)
...

Michael Hartmann
February 8th, 2000, 02:56 AM
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