Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #173

Re: Need help with writing drive property

From GS <gs@somewhere.net>
Newsgroups comp.lang.basic.visual.misc, microsoft.public.vb.general.discussion
Subject Re: Need help with writing drive property
Date 2011-05-22 00:49 -0400
Organization A noiseless patient Spider
Message-ID <ira4d1$k18$1@dont-email.me> (permalink)
References <ir98hg$5dq$1@dont-email.me> <ir9gm7$mgl$1@dont-email.me> <ir9i00$t2k$1@dont-email.me> <ir9vnu$veo$1@dont-email.me>

Cross-posted to 2 groups.

Show all headers | View raw


Mayayana expressed precisely :
>   This is really a VBS question, not a VB question.
> I suppose you can use WMI from VB if you want to,
> but you'll be dependent on the WMI service running.
> (And WMI itself requires that the DCOM Server Process
> Launcher service be running. I usually disable all that
> on "civilian" PCs because DCOM -- and WMI -- are just
> useless risks outside of corporate intranets. The only
> software usage of WMI that I'm aware of is "quick and
> dirty" system info. applets.)
>
> Here's a VBS sample that should identify everything
> you need about the available partitions.
>
> Dim WMI, Col, Ob, DriveList
> Set WMI = GetObject("WinMgmts:")
> Set Col = WMI.ExecQuery("Select * from Win32_LogicalDisk")
>   For Each Ob in Col
>     DriveList = DriveList & Ob.DeviceID & " - " & Ob.VolumeName & " Type: " 
> & Ob.DriveType & vbCrLf
>    Next
> Set Col = Nothing
> Set WMI = Nothing
> MsgBox DriveList
>
>   I don't know why they call it a "LogicalDisk". It's a logical
> drive or partition. Win32_DiskDrive is returning physical
> disks. You might be able to separate the USB drives that
> way, but you get a disk/hardware object rather than a partition
> object, so there's no drive letter. With Win32_LogicalDisk you
> get the drive letter and volume name, so that people can
> recognize which drive they want. The DriveType will return 3
> for hard disk partitions, 5 for optical, and 2 for removable.
> So you should be able to just filter out the drives of
> DriveType 2.

I'm already doing this. Problem that's arisen is USB external drives 
are DriveType 3 (Local Fixed Disk) while USB memstiks are DriveType 2 
(Removable Disk). So filtering on these in "LogicalDisk" doesn't relate 
to the hardware found in "DiskDrive". The only thing I've seen from 
"DiskDrive" that appears anywhere in Windows UI is "DiskDrive.Name 
[Model]". This is the same info that shows up in the properties 
dialog>Hardware tab AllDrives list. So I was hoping there's an API that 
will return a drive letter for a specified drive name.
>
>  (  I could have sworn I remembered you saying you were
> going to get yourself a copy of the WMI help file. :)

Yes, I did say I was going to do that. However, I already know what 
you've shared here and so I'm not looking for WMI help.

-- 
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Need help with writing drive property GS <gs@somewhere.net> - 2011-05-21 16:54 -0400
  Re: Need help with writing drive property "Mayayana" <mayayana@invalid.nospam> - 2011-05-21 19:10 -0400
    Re: Need help with writing drive property GS <gs@somewhere.net> - 2011-05-21 19:35 -0400
      Re: Need help with writing drive property "Mayayana" <mayayana@invalid.nospam> - 2011-05-21 23:27 -0400
        Re: Need help with writing drive property GS <gs@somewhere.net> - 2011-05-22 00:49 -0400
          Re: Need help with writing drive property GS <gs@somewhere.net> - 2011-05-22 00:58 -0400
        Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 02:07 -0400
          Re: Need help with writing drive property: Possible solution "MikeD" <nobody@nowhere.edu> - 2011-05-22 09:02 -0400
            Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 14:29 -0400
              Re: Need help with writing drive property: Possible solution "MikeD" <nobody@nowhere.edu> - 2011-05-22 17:01 -0400
                Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 18:28 -0400
                Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 18:29 -0400
                Re: [OT] Bolding text. Dee Earley <dee.earley@icode.co.uk> - 2011-05-23 10:54 +0100
                Re: [OT] Bolding text. "Jim Mack" <no-uce-ube@mdxi.com> - 2011-05-23 09:33 -0400
                Re: [OT] Bolding text. Helmut_Meukel <Helmut_Meukel@bn-hof.invalid> - 2011-05-23 17:48 +0200
                Re: [OT] Bolding text. Helmut_Meukel <Helmut_Meukel@bn-hof.invalid> - 2011-05-23 18:00 +0200
                Re: [OT] Bolding text. Dee Earley <dee.earley@icode.co.uk> - 2011-05-24 10:44 +0100
                Re: Need help with writing drive property: Possible solution "MikeD" <nobody@nowhere.edu> - 2011-05-23 08:51 -0400
                Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-23 10:48 -0400
          Re: Need help with writing drive property: Possible solution "Mayayana" <mayayana@invalid.nospam> - 2011-05-22 09:23 -0400
            Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 14:36 -0400
            Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 14:49 -0400
            Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 16:26 -0400
              Re: Need help with writing drive property: Possible solution "Mayayana" <mayayana@invalid.nospam> - 2011-05-22 18:29 -0400
                Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 18:33 -0400
              Re: Need help with writing drive property: Possible solution "Mayayana" <mayayana@invalid.nospam> - 2011-05-22 18:36 -0400
                Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 18:49 -0400
                Re: Need help with writing drive property: Possible solution "Mayayana" <mayayana@invalid.nospam> - 2011-05-22 20:48 -0400
                Re: Need help with writing drive property: Possible solution GS <gs@somewhere.net> - 2011-05-22 21:30 -0400
  Re: Need help with writing drive property "MikeD" <nobody@nowhere.edu> - 2011-05-21 19:42 -0400
    Re: Need help with writing drive property GS <gs@somewhere.net> - 2011-05-21 20:14 -0400
  Re: Need help with writing drive property - Final Approach GS <gs@somewhere.net> - 2011-05-23 13:20 -0400

csiph-web