Using performance counters with different UI languages
I would like to read a few performance counters in my C# application, like "Processor\% Idle Time", but th开发者_如何学Pythonis only works on English systems. Since performance counters need to be initialized using the counter category and names, how can I make my code run under different UI languages?
After much searching, I found this MS KB article that explains how to retrieve the localized counter names using hard-coded index values: http://support.microsoft.com/kb/287159
Once you get the hard-coded index value from the registry, just pass it to the PdhLookupPerfNameByIndex method and it will return the localized counter name.
精彩评论