I am developing an EXE in VB.NET. This EXE is called by another program and that program waits until my EXE has finished (I think by using WaitForSingleObject but Im not sure). My problem now is that the calling application wants to receive a return code. It is reading the return code by GetExitCodeProcess. But how can I send the return code? I tried Environment.Exit(42) and Environment.ExitCode = 42 and ExitProcess(42) (API) but everytime I get a 0. Are there some more possibilities to send a return code?