Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Need help in working WMI

Need help in working WMI

Scheduled Pinned Locked Moved Managed C++/CLI
helpperformance
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    Xeqtr 0
    wrote on last edited by
    #1

    Hi, I have a problem in getting name or other information about USB Memory Sticks among Hard Drives and removable devices by WMI function "Win32_DiskDrive". There is a code where I tried to get USB Device. public: String ^ LogicalDriveInfo(Management::ManagementObject ^ mo, bool shared) { String ^ Name1; String ^ txt = mo["InterfaceType"]->ToString(); do { Name1 = Convert::ToString(txt[0]); }while (txt == "USB"); return Name1; } //then by button click I try to get private: System::Void btnShellApp_Click(System::Object^ sender, System::EventArgs^ e) { Management::ManagementObjectSearcher ^ que = gcnew Management::ManagementObjectSearcher(gcnew Management::SelectQuery("SELECT * FROM Win32_DiskDrive" )) ; // for each (Management::ManagementObject ^ obj in que->Get()) { lblSN->Text = LogicalDriveInfo(obj,true); } } But there are no results to detect only UBS device.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups