Getting Motherboard Type
I've been rummaging through the net trying to find a way to get the motherboard information of the system in which my code is running. Basically I have three types of motherboards where 2 of them run my code slightly different from another.
All I need is a name, such as "ASUS", "ASROCK", etc.
Anyone have any pointers? I'd prefer not to have the user to go into a config file and specify a motherboard type. User proofing software takes up so much extra time.
You can get that information from WMI and the Win32_BaseBoard class - but why not just write your code to be correct regardless of the MB you're running on?
Well, this is a fix for some code I wrote to mute input devices in Windows XP. I don't have the code in front of me, since it's at work, but I built it around the way we mapped out the input devices on the system. The code I wrote works fine for one motherboard, but when I move it to the next, I found that it must have an extra device that I didn't account for. So, when I chose the devices on Motherboard A, I knew that it would be device 2 and 3 that I wanted, but on motherboard B, it was device 3 and 4. Basically it boils down to not having a definitive way to pinpoint the device from the methods I've found on the MSDN site. Now I could probably go back and rewrite the way we initially map the devices, but I was worried about how intertwined all the code was (3 years of development with the documentation year cut off), because we have a very poorly written SDD. The last thing I need is more bugs!
I think that what will end up happening, is I'll put a config file that is used for future computers that use the software (which I'd be the person configuring) and read from that, but the computers out in the field will just have to deal with the motherboard fix that I was going to write. I'll probably take a look to see if there's a way to merge the old code with the stuff I've written recently again, but I'm not sure that I won't come to the same conclusion about it breaking something else.
BTW, thanks for pointing out that Win32_BaseBoard class! I think that's exactly what I was looking for.
Simple example of using WMI with MSVC (including Express editions): http://cboard.cprogramming.com/cplus...tml#post900756