Article ID: 125213
Article Last Modified on 12/9/2003
125212 Performing a Synchronous Spawn Under Win32s
/* Compile options needed: /MD /DWIN32 <filename>.c /link user32.lib
*/
#include <windows.h>
#include <process.h>
void main( )
{
DWORD dwVersion;
int status;
char buf[80];
dwVersion = GetVersion();
if( !(dwVersion & 0x80000000) )
{
// Windows NT: NOTEPAD must be closed before this call completes.
status = _spawnl( _P_WAIT, "c:\\winnt35\\system32\\notepad.exe",
"notepad.exe", "dummy", NULL );
}
else if( LOBYTE(LOWORD(dwVersion)) < 4 )
{
// Win32s: This call completes before NOTEPAD is closed.
status = _spawnl( _P_WAIT, "c:\\windows\\notepad.exe",
"notepad.exe", "dummy", NULL );
}
else
{
// Windows 95: for future reference.
}
wsprintf( buf, "Return Value = 0x%x\n", status );
MessageBox( NULL, buf, "Test", MB_OK );
}
Additional query words: _spawnle _spawnlp _spawnlpe _spawnv _spawnve _spawnvp _spawnvpe win32sdk win32s
Keywords: kbcrt kbprb KB125213