IAnalysisWarnings::GetCount 方法
取得 IAnalysisWarnings 集合中包含的 IAnalysisWarning 物件數目。
語法
HRESULT GetCount(
[out, retval] ULONG *pulCount
);
參數
-
pulCount [out, retval]
-
IAnalysisWarnings集合中包含的IAnalysisWarning物件數目。
傳回值
如需傳回值的描述,請參閱 類別和介面 - 筆跡分析。
範例
下列範例顯示 _IAnalysisEvents::Results 事件的事件處理常式大綱。 處理常式會檢查 IAnalysisStatus::IsSuccessful。 如果分析作業產生警告,處理常式會逐一查看 IAnalysisWarning 物件的集合。
// _IAnalysisEvents::Results event handler.
STDMETHODIMP CMyClass::Results(
IInkAnalyzer *pInkAnalyzer,
IAnalysisStatus *pAnalysisStatus)
{
// Check the status of the analysis operation.
VARIANT_BOOL bResult = VARIANT_FALSE;
HRESULT hr = pAnalysisStatus->IsSuccessful(&bResult);
if( SUCCEEDED(hr) )
{
if( bResult )
{
// Insert code that handles a successful result.
}
else
{
// Get the analysis warnings.
IAnalysisWarnings* pAnalysisWarnings = NULL;
hr = pAnalysisStatus->GetWarnings(&pAnalysisWarnings);
if (SUCCEEDED(hr))
{
// Iterate through the warning collection.
ULONG warningCount = 0;
hr = pAnalysisWarnings->GetCount(&warningCount);
if (SUCCEEDED(hr))
{
IAnalysisWarning *pAnalysisWarning = NULL;
AnalysisWarningCode analysisWarningCode;
for (ULONG index=0; index<warningCount; index++)
{
// Get an analysis warning.
hr = pAnalysisWarnings->GetAnalysisWarning(
index, &pAnalysisWarning);
if (SUCCEEDED(hr))
{
// Get the warning code for the warning.
hr = pAnalysisWarning->GetWarningCode(
&analysisWarningCode);
if (SUCCEEDED(hr))
{
// Insert code that handles each
// analysis warning.
}
}
// Release this reference to the analysis warning.
if (pAnalysisWarning != NULL)
{
pAnalysisWarning->Release();
pAnalysisWarning = NULL;
}
if (FAILED(hr))
{
break;
}
}
}
}
// Release this reference to the analysis warnings collection.
if (pAnalysisWarnings != NULL)
{
pAnalysisWarnings->Release();
pAnalysisWarnings = NULL;
}
}
}
return hr;
}
規格需求
需求 | 值 |
---|---|
最低支援的用戶端 |
Windows XP Tablet PC Edition [僅限傳統型應用程式] |
最低支援的伺服器 |
都不支援 |
標頭 |
|
DLL |
|