共用方式為


IDebugEngineLaunch2::LaunchSuspended

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

This method launches a process by means of the debug engine (DE).

Syntax

HRESULT LaunchSuspended ( 
   LPCOLESTR             pszMachine,
   IDebugPort2*          pPort,
   LPCOLESTR             pszExe,
   LPCOLESTR             pszArgs,
   LPCOLESTR             pszDir,
   BSTR                  bstrEnv,
   LPCOLESTR             pszOptions,
   LAUNCH_FLAGS          dwLaunchFlags,
   DWORD                 hStdInput,
   DWORD                 hStdOutput,
   DWORD                 hStdError,
   IDebugEventCallback2* pCallback,
   IDebugProcess2**      ppDebugProcess
);
int LaunchSuspended(
   string               pszServer,
   IDebugPort2          pPort,
   string               pszExe,
   string               pszArgs,
   string               pszDir,
   string               bstrEnv,
   string               pszOptions,
   enum_LAUNCH_FLAGS    dwLaunchFlags,
   uint                 hStdInput,
   uint                 hStdOutput,
   uint                 hStdError,
   IDebugEventCallback2 pCallback,
   out IDebugProcess2   ppProcess
);

Parameters

pszMachine
[in] The name of the machine in which to launch the process. Use a null value to specify the local machine.

pPort
[in] The IDebugPort2 interface representing the port that the program will run in.

pszExe
[in] The name of the executable to be launched.

pszArgs
[in] The arguments to pass to the executable. May be a null value if there are no arguments.

pszDir
[in] The name of the working directory used by the executable. May be a null value if no working directory is required.

bstrEnv
[in] Environment block of NULL-terminated strings, followed by an additional NULL terminator.

pszOptions
[in] The options for the executable.

dwLaunchFlags
[in] Specifies the LAUNCH_FLAGS for a session.

hStdInput
[in] Handle to an alternate input stream. May be 0 if redirection is not required.

hStdOutput
[in] Handle to an alternate output stream. May be 0 if redirection is not required.

hStdError
[in] Handle to an alternate error output stream. May be 0 if redirection is not required.

pCallback
[in] The IDebugEventCallback2 object that receives debugger events.

ppDebugProcess
[out] Returns the resulting IDebugProcess2 object that represents the launched process.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Remarks

Normally, Visual Studio launches a program using the LaunchSuspended method and then attaches the debugger to the suspended program. However, there are circumstances in which the debug engine may need to launch a program (for example, if the debug engine is part of an interpreter and the program being debugged is an interpreted language), in which case Visual Studio uses the IDebugEngineLaunch2::LaunchSuspended method.

The ResumeProcess method is called to start the process after the process has been successfully launched in a suspended state.

See also