Results 1 to 13 of 13

Thread: [2008] HDDs & Their Letters

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2008
    Location
    Czech Republic
    Posts
    55

    Angry [2008] HDDs & Their Letters

    Hi! I have a problem. I want to get letters to each harddrive I have recognized in WMI . I give an example:

    I have:

    1x HDD (400 GB) Samsung (fixed) - 4 partitions (one of them is for Linux, the biggest problem!)
    1x HDD (250 GB) Seagate (external) - 1 partition

    And in Windows I can see 4 harddrives. So the thing: How can I get exact letters belonging to Samsung, and letter(s) belonging to Seagate? Make sure, that user can have more drives and more partition (maybe Linux too) ... I can divide my Seagate too, like 20 GB and 230 GB ... you know. I've checked much things in WMI like Win32_DiskPartition, but it does not help me so much ... Thanks for any suggestions
    Code Hard, Go Pro!

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] HDDs & Their Letters

    Does it have to be through WMI?
    If not cant you just use the My.Computer.FileSystem.Drives collection?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2008
    Location
    Czech Republic
    Posts
    55

    Re: [2008] HDDs & Their Letters

    Hm, I ve checked that too, but how can I assign letters to HDD Model and everything? I am programming an informational and benchmark program now.
    Like in HDTach: example ...

    Samsung HD420JL ( C:,D:,E: ) - 400 GB ... How can I recognize these letters in disk has partitions?
    Code Hard, Go Pro!

  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] HDDs & Their Letters

    What do you mean you want to actually give the HDs letters? Or do you mean you just want to find out what letters they already have?
    I am sure each item in the Drives collection I mentioned has a property called DriveLetter or something...
    As for finding out the model etc then yeah you probably will need WMI or something similar for that
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2008
    Location
    Czech Republic
    Posts
    55

    Re: [2008] HDDs & Their Letters

    Yes, I have to find out hard disk model in WMI. But, I want to know, what letter (or letters if it has more partitions) Windows use for this HD (HD, that I found in WMI before).

    I think it's a bit harder than I thought.
    Last edited by iMPR3SSiON; Feb 4th, 2009 at 01:44 PM.
    Code Hard, Go Pro!

  6. #6
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] HDDs & Their Letters

    You can use that Drives collection I mentioned for the drive letters like I said

    vb Code:
    1. For Each Drive As IO.DriveInfo In My.Computer.FileSystem.Drives
    2.             MessageBox.Show(Drive.Name)
    3. Next
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  7. #7

    Thread Starter
    Member
    Join Date
    Jul 2008
    Location
    Czech Republic
    Posts
    55

    Re: [2008] HDDs & Their Letters

    Oh, I wish you speak in Czech language No, but how can I know, that Drive D: is my Samsung HD242456LA (<- I made it up) and letter J: and K: is my partitioned Seagate? How could program know which letter is assigned to each harddrive? I dont know how to explain it better
    Code Hard, Go Pro!

  8. #8
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] HDDs & Their Letters

    Ahhh I see what you mean now! Sorry.
    So have you already got the WMI bit working that gets the model number etc? If not, here's an example: http://www.geekpedia.com/tutorial233...nd-Csharp.html

    Also, this might help you get the drive letter: http://bytes.com/groups/net-c/272971...em#post1091940
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  9. #9

    Thread Starter
    Member
    Join Date
    Jul 2008
    Location
    Czech Republic
    Posts
    55

    Re: [2008] HDDs & Their Letters

    I am sorry. My English is rubbish, really.
    Can I add C# into my VB.NET project? Or convert it somehow?

    EDIT: I don't really understand it ... it's kind of messy text here and there. Can you describe, how can I get these letters?
    It will help me a lot, I can put your weblink or your nick into my program's About box, if it will be done. Thank you.
    Last edited by iMPR3SSiON; Feb 4th, 2009 at 02:47 PM.
    Code Hard, Go Pro!

  10. #10

    Thread Starter
    Member
    Join Date
    Jul 2008
    Location
    Czech Republic
    Posts
    55

    Re: [2008] HDDs & Their Letters

    Hey, guys!

    Can somebody explain me this mess here:
    http://bytes.com/groups/net-c/272971...letter-problem
    It would help me a lot, thanks.
    Code Hard, Go Pro!

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] HDDs & Their Letters

    gigemboy has provided a CodeBank submission on this very site that demonstrates getting all sorts of information using WMI.

    http://www.vbforums.com/showthread.php?t=387626

    No, you can't add C# code to a VB project or vice versa. Each project can contain only one language. Each project can reference other projects though, and those other projects could written in another language.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  12. #12

    Thread Starter
    Member
    Join Date
    Jul 2008
    Location
    Czech Republic
    Posts
    55

    Re: [2008] HDDs & Their Letters

    Thanks for the link, but actually it is unable to download this DLL file. I have just problem with HDD Letters ... can you help?
    You know, if you have this DLL, you can provide another link (mediafire.com ...), it will be handy
    Code Hard, Go Pro!

  13. #13

    Thread Starter
    Member
    Join Date
    Jul 2008
    Location
    Czech Republic
    Posts
    55

    Re: [2008] HDDs & Their Letters

    Please, can anyone help? I really need this ...
    Code Hard, Go Pro!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width