Arrrhhhggg...
Pulling my hair out.
I tried it the way from the first link you found, and everything is fine until you need to include:
#include "comdef.h"
#include "Wbemidl.h"

These two files come with the platform SDK, so after downloading for ages, put the right paths in and bummer, the most errors I have ever got. 16861 to be exact. Thats a lot of errors.

All from these include files. So I dont know much about this, but I get the impression if its not included with mingw32 then we have no chance.....

Have you had any luck?