Partager via


IVsSolutionBuildManager2.QueryDebugLaunch Method

Determines whether or not the F5 (debug start) key should be enabled.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function QueryDebugLaunch ( _
    grfLaunch As UInteger, _
    <OutAttribute> ByRef pfCanLaunch As Integer _
) As Integer
int QueryDebugLaunch(
    uint grfLaunch,
    out int pfCanLaunch
)
int QueryDebugLaunch(
    [InAttribute] unsigned int grfLaunch, 
    [OutAttribute] int% pfCanLaunch
)
abstract QueryDebugLaunch : 
        grfLaunch:uint32 * 
        pfCanLaunch:int byref -> int
function QueryDebugLaunch(
    grfLaunch : uint, 
    pfCanLaunch : int
) : int

Parameters

  • grfLaunch
    Type: UInt32

    [in] Specifies how the debugger is launched. See __VSDBGLAUNCHFLAGS for more information.

  • pfCanLaunch
    Type: Int32%

    [out] Pointer to a flag indicating whether or not the debug operation can be launched.

Return Value

Type: Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsSolutionBuildManager2::QueryDebugLaunch(
   [in] VSDBGLAUNCHFLAGS grfLaunch,
   [out] BOOL *pfCanLaunch
);

The solution build manager tracks which project is the startup project. The debugger manager component of the environment does not know directly what the startup project is, so it calls QueryDebugLaunch to ask the solution build manager whether or not the F5 key should be enabled for the startup project, or for the selected project if DBGLAUNCH_Selected is set.

Then, if a user presses the F5 key, the debugger manager component of the environment calls this method again and DebugLaunch sets pfCanLaunch to true. The startup projects' configuration selected for the active solution configuration then launches the appropriate debugger process during the call to DebugLaunch when the F5 key is pressed.

The F5 command causes the debugger manager component of the environment to call DebugLaunch on each startup project, for the active project configuration (selected by the active solution configuration), or any other package that traps that command.

When the user presses the F5 key, the debugger manager component of the environment enters the debug mode and calls DebugLaunch which queries the projector projects through their implementation of DebugLaunch on the active project configuration(s) on the active project configuration of each of the startup projects. When the environment is in debug mode, the project or projects being debugged know the state of the process, whether it is running or at a breakpoint. The debugger manager component of the environment calls QueryDebugLaunch and enables the F5 key with Continue when a breakpoint is reached in the debugging process.

At the point where the environment exits debug mode because it finished or was canceled by the user and you are back in design mode, the F5 key is enabled.

QueryDebugLaunch and DebugLaunch are normally only called by the debug manager component of the environment to manage the debug start command when in design mode to determine whether or not debug launch should be enabled. If enabled, when the F5 key is pressed the debug manager component of the environment calls DebugLaunch to initiate the debug process for each project in the list of startup projects.

If there is no startup project for the solution, the F5 key will be disabled.

.NET Framework Security

See Also

Reference

IVsSolutionBuildManager2 Interface

Microsoft.VisualStudio.Shell.Interop Namespace