Leveraging Windows Vista's Windows System Assessment Tool (WinSAT) API in Visual Basic
A couple of days ago a noticed this article, downloaded the code, thought about it for a bit and realized that although he had a great idea... I had a few problems with the implementation. I really distaste the idea of "unsafe" code unless there is absolutely no way around using it... and even then I'd probably choose to implement a solution using C/C++ if that was the case. I also didn't like the fact that he was using GetEnumerator instead of using the much more friendly foreach functionality and because he was using GetEnumerator, he was having to do some unnecessary casting in the process. Finally, implementing this as a console application just seemed wrong somehow; especially since he was still showing a windows form from the console app to demonstrate the ability to garner the Windows Vista generated image representing the base score.
Since the article was very C# centric, I figured I'd tackle the same subject from from a VB point of view. Along the way, I think I've improved upon the overall subject, produced a better sample and (hopefully) avoided some of the pitfalls that I noticed in the original article/sample. Here's a screen shot of the sample that I build:
Article: Leveraging Windows Vista's Windows System Assessment Tool (WinSAT) API in Visual Basic