共用方式為


IVsSolutionBuildManager.QueryDebugLaunch(UInt32, Int32) Method

Definition

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

public:
 int QueryDebugLaunch(System::UInt32 grfLaunch, [Runtime::InteropServices::Out] int % pfCanLaunch);
int QueryDebugLaunch(unsigned int grfLaunch, [Runtime::InteropServices::Out] int & pfCanLaunch);
public int QueryDebugLaunch (uint grfLaunch, out int pfCanLaunch);
abstract member QueryDebugLaunch : uint32 * int -> int
Public Function QueryDebugLaunch (grfLaunch As UInteger, ByRef pfCanLaunch As Integer) As Integer

Parameters

grfLaunch
UInt32

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

pfCanLaunch
Int32

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

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsSolutionBuildManager::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.

Applies to