|
|
Comments and Discussions
|
|
 |

|
the first time call PdhEnumObjects and set buffersize as 0 , when call successed , it returns PDH_MORE_DATA but not ERROR_SUCCESS. XP and VC.6.0
void CPdh::EnumObjects(LPCTSTR pszMachineName, CStringArray& objects, DWORD dwDetailLevel, BOOL bRefresh)
{
//First call the function to determine the size of buffer required
DWORD dwBufferSize = 0;
PDH_STATUS Status = PdhEnumObjects(NULL, pszMachineName, NULL, &dwBufferSize, dwDetailLevel, bRefresh);
if (Status == ERROR_SUCCESS ) //in your code..
{
.........
}
//Throw an exception if anything goes wrong
if (Status != ERROR_SUCCESS)
ThrowPdhException(Status);
}
void CPdh::EnumObjects(LPCTSTR pszMachineName, CStringArray& objects, DWORD dwDetailLevel, BOOL bRefresh)
{
//First call the function to determine the size of buffer required
DWORD dwBufferSize = 0;
PDH_STATUS Status = PdhEnumObjects(NULL, pszMachineName, NULL, &dwBufferSize, dwDetailLevel, bRefresh);
if (Status == PDH_MORE_DATA ) //i change it in my code..
{
.........
}
//Throw an exception if anything goes wrong
if (Status != ERROR_SUCCESS)
ThrowPdhException(Status);
}
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
A collection of freeware MFC classes to encapsulate the NT Performance Counters.
| Type | Article |
| Licence | |
| First Posted | 3 Mar 2000 |
| Views | 62,486 |
| Bookmarked | 26 times |
|
|