Hi,
Today I have first time in my life used Code Blocks program. So far I have not heard about this programm. Can someone help me write in C++ or C the DLL that returns two (following) functions as STRING type using WMI (Windows Management Instrumentation)?
1/. My first code I would like to use (writen in C#) in DLL is here:
"
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["ProcessorId"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}
}
}
}
"
2/. My second code I would like to use (writen in C#) in DLL is here:
"
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_DiskDrive");
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_DiskDrive instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("SerialNumber: {0}", queryObj["SerialNumber"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}
}
}
}
"
My Questions Are:
1/. How to write and export above functions into one DLL ?
2/. What debugger should I use and how to configure compiler ?
P.s.: I have already installed on my PC (Windows7 32 Bit): SDK for .NET 3.5 SP1, SDK for .NET 4.
3/. Please for any example here and/or e-mail me.