question

Wami007-9389 avatar image
0 Votes"
Wami007-9389 asked ·

C++/CLI ManagmentObjectSearcher using

private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
ManagementObjectSearcher^ searcher = gcnew ManagementObjectSearcher("select*from Win32_BIOS ");
lb1->Text = Convert::ToString(searcher);
}



Hello,

I wanna Define Hardware info to my Label, but it shows me " System.Managment.Object.Searcher ". Can Anyone help me for it, with correct sample code :(

dotnet-csharpc++dotnet-runtime-framework
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered ·

For example, if you want to display the manufacturer and serial number, then:

 ManagementObjectSearcher searcher( "select * from Win32_BIOS" );
 for each( ManagementObject ^ d in searcher.Get( ) )
 {
      lb1->Text = d["Manufacturer"]->ToString( );
      lb2->Text = d["SerialNumber"]->ToString( );
    
      break;
 }
· 3 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

But, how to get Ram, CPU, GPU info like this>?

0 Votes 0 ·

The available data of Win32_BIOS are described in documentation: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-bios.

If you need something different, I think you can start a different question. Maybe not all the details are available in WMI, so other techniques can be considered too.

0 Votes 0 ·

Thanksç do i need change data types for avaible data ? or just type name ?

0 Votes 0 ·