szczurek - 2011-10-26

Hi,

I need instruction how to use the System.Management in Dev-cpp. I would like
to get some informations from WMI such as: Processor_ID, HDD_ID, MAINBOARD_ID.

Can anybody give me the step by step information how to obtain informations
like that from WMI under DEV-C++ compilator?

I have version 4.9.9.2 of DEV-C++

The sample code I would like to use in DEV-C++ is:

"
using System;
using System.Management;
using System.Windows.Forms;

namespace WMISample
{
public class MyWMIQuery
{
public static void Main()
{
try
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\CIMV2",
"SELECT * FROM Win32_Processor");

foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_Processor instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("ProcessorId: {0}", queryObj);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI data: " +
e.Message);
}
}
}
}
"

... but it does not work on DEV-CPP

I got the ERROR COMPILE CODE AS FOLLOWING:

"
Kompilator: Default compiler
Building Makefile: "C:\Dev-Cpp\test_WMI\Makefile.win"
Wykonywanie make...
make.exe -f "C:\Dev-Cpp\test_WMI\Makefile.win" all
g++.exe -c main_wmi_test.cpp -o main_wmi_test.o -I"C:/Dev-
Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward"
-I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C
:/Dev-Cpp/include" -I"C:/Dev-Cpp/WMI"

main_wmi_test.cpp:1: error: expected nested-name-specifier before "System"
main_wmi_test.cpp:1: error: System' has not been declared main_wmi_test.cpp:2: error: expected nested-name-specifier before "System" main_wmi_test.cpp:2: error:System' has not been declared

main_wmi_test.cpp:2: error: expected ;' before '.' token main_wmi_test.cpp:2: error: expected unqualified-id before '.' token main_wmi_test.cpp:2: error: expected,' or ;' before '.' token main_wmi_test.cpp:3: error: expected nested-name-specifier before "System" main_wmi_test.cpp:3: error:System' has not been declared
main_wmi_test.cpp:3: error: expected `;' before '.' token
main_wmi_test.cpp:3: error: expected unqualified-id before '.' token
"

I don't know how to repair it.

Rgds,