Share via


IDebugProgramNode2::GetProgramName

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

Gets the name of the program.

Syntax

HRESULT GetProgramName (
    BSTR* pbstrProgramName
);
int GetProgramName (
    out string pbstrProgramName
);

Parameters

pbstrProgramName
[out] Returns the name of the program.

Return Value

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

Remarks

The name of a program is not the same thing as the path to the program, although the name of the program may be part of such a path.

Example

The following example shows how to implement this method for a simple CProgram object that implements the IDebugProgramNode2 interface. The MakeBstr function allocates a copy of the specified string as a BSTR.

HRESULT CProgram::GetProgramName(BSTR* pbstrProgramName) {
    if (!pbstrProgramName)
        return E_INVALIDARG;

    // Assign the member program name to the passed program name.
    *pbstrProgramName = MakeBstr(m_pszProgramName);
    return NOERROR;
}

See also