CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2008
    Location
    Shanghai' China
    Posts
    32

    Convert from \Device\HarddiskVolume1 to C:

    As we know we can convert from C: to \Device\HarddiskVolume1 by QueryDosDevice,
    is there any way to convert from \Device\HarddiskVolume1 to C: ?

    Thanks
    DraculaW

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    894

    Re: Convert from \Device\HarddiskVolume1 to C:

    No, not really. You'll have to write it yourself. Here's how:

    1. Get all valid drives in the system with the GetLogicalDriveStrings() call;

    2. Go through all of them and convert each using QueryDosDevice() and check if the result matches the beginning of your path. If it does, then you have your conversion.

  3. #3
    Join Date
    Apr 2008
    Location
    Shanghai' China
    Posts
    32

    Re: Convert from \Device\HarddiskVolume1 to C:

    Quote Originally Posted by dc_2000
    No, not really. You'll have to write it yourself. Here's how:

    1. Get all valid drives in the system with the GetLogicalDriveStrings() call;

    2. Go through all of them and convert each using QueryDosDevice() and check if the result matches the beginning of your path. If it does, then you have your conversion.
    Thanks for your reply
    That's what actully i did.
    DraculaW

  4. #4
    Join Date
    Jun 2009
    Posts
    11

    Re: Convert from \Device\HarddiskVolume1 to C:

    Hey DraculaW,
    I saw this post and for the most part this is what I want to do. All I want to do is input the drive letter and get the physical device number. (i.e. input F and get back \Device\HardDisk2\...). Any chance you know how to do this in VB.NET. I can do this in VB6 but no way have I found out in VB.NET. Any help would be appreciated.

    gmorris

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

Featured