Hello all,

I have a VB.net application and a C++ DLL.
The C++ DLL has an exported function that gets called by the VB.net application.

The C++ exported function is as following:

STARTUPINFO         si;

    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    ZeroMemory( &pi, sizeof(pi) );

    TR::Log( "Starting ( %s )", m_fullPath.c_str() );

    // Start the child process.
     if( ! CreateProcess( const_cast<LPCSTR>(m_fullPath.c_str()), // filename of the process
        NULL,		// command line arguments if present
        NULL,             // Process handle not inheritable.
        NULL,             // Thread handle not inheritable.
        FALSE,            // Set handle inheritance to FALSE.
        DETACHED_PROCESS, // debug the process, but not spawned off childs
        NULL,             // Use parent's environment block.
        NULL,             // Use parent's starting directory.
        &si,              // Pointer to STARTUPINFO structure.
        &pi )             // Pointer to PROCESS_INFORMATION structure.
        TR::Log( "CreateProcess failed (%d).\n", GetLastError() );

    m_hProcess      = pi.hProcess;

    m_dwProcessID   = pi.dwProcessId;
    TR::Log( "PID %i", m_dwProcessID );

The logfile contains:

Starting ( C:\testMe.exe )
PID 1356

So it would seems everything is working(as we have a PID and CreateProcess does not fail). But the application's window does not show up(tried both with Console application and normal application) and the PID is not visible in the task manager.
Besides the application I run a driver that registered a 'Process Create Notify'. This notification routine gets called with the same PID.

I added a messagebox in the DLL's main: The DLL is initialized before CreateProcess is called. I also tried, in the DLL, to create a thread the calls the function with CreateProcesss just to be sure.

I also tried several different dwCreationFlags in CreateProcess, like CREATE_NEW_CONSOLE and just '0' etc.

7 Years
Discussion Span
Last Post by thelamb
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.