I have a complicated database configuration tool in VB.NET. It is being called from an NT service (coded in C++). I need to know how to pass back from VB.NET to C++ whether or not my VB.NET app finished with no errors.

In C I would simply do return 0 or return 1, quite simple. But how can you "return" a value in a VB.NET exe?

Here's how I'm calling it from C++, just so you know...


BOOL bRetVal= CreateProcess( NULL, // pointer to name of executable module
(char *) szCmdLine, // pointer to command line string
NULL, // pointer to process security attributes
NULL, // pointer to thread security attributes
TRUE, // handle inheritance flag
CREATE_NEW_CONSOLE | IDLE_PRIORITY_CLASS, // creation flags
NULL, // pointer to new environment block
szWorkingDir, // pointer to current directory name
&StartupInfo, // pointer to STARTUPINFO
&pi // pointer to PROCESS_INFORMATION
);

//
// If the function fails, the return value is zero
//

if ( bRetVal == 0 )
{
CString strMsg;
strMsg.Format( _T("Unable to Create process: %s"), szCmdLine );
LogError( strMsg );
return FALSE;
}

dwRetVal = WaitForSingleObject( pi.hProcess, WaitTime );

switch ( dwRetVal )
{

... down here I handle the cases based on dwRetVal. So basically my question involves getting a VB app to return different values when the API "WaitForSingleObject" is used on the process.

Thanks,

Jacob438