Edit

Share via


IDebugProgramNode2::GetProgramName

Gets the name of the program.

Syntax

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