IDebugHostModule2::GetImageName 方法 (dbgmodel.h)

GetImageName 方法返回模块的图像名称。 根据 allowPath 参数的值,返回的图像名称可能包含也可能不包含图像的完整路径。

语法

HRESULT GetImageName(
  bool allowPath,
  BSTR *imageName
);

参数

allowPath

如果为 true,则指示输出中可能包含模块的完整路径。 是否包含此类路径由特定的调试主机和模块的加载方式决定。 如果为 false,则表示只有模块的图像名称将包含在输出中。

imageName

模块 (或完整路径) 的图像名称将作为分配的字符串返回在此处。 调用方负责调用 SysFreeString,以便在使用后释放字符串。

返回值

此方法返回指示成功或失败的 HRESULT。

注解

示例代码

ComPtr<IDebugHostModule> spModule; /* get a module (see FindModuleByName) */

BSTR imageName;
if (SUCCEEDED(spModule->GetImageName(false, &imageName)))
{
    // imageName is the name of the image (guaranteed not to have a path 
    // in it).  For instance, this might be "notepad.exe"
    SysFreeString(imageName);
}

要求

要求
Header dbgmodel.h

另请参阅

IDebugHostModule2 接口