Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

_spawn (msvcrt)
 
.
Summary
spawn, wspawn Functions

C# Signature:

[DllImport("msvcrt.dll", CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr _wspawnl(
         int mode,  // _P_ constant (_P_WAIT=0, _P_NOWAIT=1)
         [MarshalAs(UnmanagedType.LPWStr)]string cmdname,
         [MarshalAs(UnmanagedType.LPWStr)]string arg0,
         [MarshalAs(UnmanagedType.LPWStr)]string arg1,
         [MarshalAs(UnmanagedType.LPWStr)]string argNULL);

VB Signature:

Declare Function _spawn Lib "msvcrt.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

C# Sample Code

Please add some!

    [DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
    static extern IntPtr _wspawnl(
         int mode,  // _P_ constant (_P_WAIT=0, _P_NOWAIT=1)
         [MarshalAs(UnmanagedType.LPWStr)]string cmdname,
         [MarshalAs(UnmanagedType.LPWStr)]string arg0,
         [MarshalAs(UnmanagedType.LPWStr)]string arg1,
         [MarshalAs(UnmanagedType.LPWStr)]string argNULL);
    static int _P_WAIT = 0;     // Suspends calling thread until execution of new process
                    // is complete (synchronous _spawn).
    static int _P_NOWAIT = 1;   // Continues to execute calling process concurrently with
                    // new process (asynchronous _spawn).
    static int _P_OVERLAY = 2;  // Overlays calling process with new process, destroying
                    // the calling process (same effect as _exec calls).
    static int _P_NOWAITO = 3;  // Continues to execute calling process concurrently with
                    // new process (asynchronous _spawn).
    static int _P_DETACH = 4;   // Continues to execute the calling process; new process
                    // is run in the background with no access to the console
                    // or keyboard. Calls to _cwait against the new process will
                    // fail (asynchronous _spawn).

    // start process AppName and destroy the current process
    _wspawnl(_P_OVERLAY, AppName, "", "", null);

Documentation
_spawn on MSDN

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions