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);
}
要求
要求 | 價值 |
---|---|
標頭 | dbgmodel.h |