Discussion:
Need help with writing drive property
(too old to reply)
GS
2011-05-21 20:54:04 UTC
Permalink
I'm looking for a VB solution to put a value into a logical drive's
StatusInfo property. I've tried using FSO but can't seem to be able to
make it work due to not having any info for proper syntax to write.
(Never did this before; just read only)

What I'm trying to do is place a temporary 'tag' on a specific drive so
I can query the value via WMI Win32_DiskDrive.

Any help/direction would be most appreciated.
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Mayayana
2011-05-21 23:10:15 UTC
Permalink
According to the help, the StatusInfo property
of Win32_DiskDrive is read-only. I don't see any
properties that are R/W other than setting a
volume name. Why not just save a file to the
root folder?

| I'm looking for a VB solution to put a value into a logical drive's
| StatusInfo property. I've tried using FSO but can't seem to be able to
| make it work due to not having any info for proper syntax to write.
| (Never did this before; just read only)
|
| What I'm trying to do is place a temporary 'tag' on a specific drive so
| I can query the value via WMI Win32_DiskDrive.
|
| Any help/direction would be most appreciated.
|
| --
| Garry
|
| Free usenet access at http://www.eternal-september.org
| ClassicVB Users Regroup! comp.lang.basic.visual.misc
|
|
GS
2011-05-21 23:35:24 UTC
Permalink
Post by Mayayana
According to the help, the StatusInfo property
of Win32_DiskDrive is read-only. I don't see any
properties that are R/W other than setting a
volume name. Why not just save a file to the
root folder?
Thanks Mayayana! I'm not saving files and so your obvious suggestion
doesn't apply.

I was looking for a way to let users choose a removeable drive to
install an app that requires portable licensing to work with the USB
device. I already have a working solution for USB memstiks (Removeable
Disk) but now I need to add USB external drives (Local Fixed Disk).

What I've come up with so far is to list all drives via Win32_DiskDrive
with InterfaceType "USB". Problem now is to get the selected drive's
Drive letter. Any suggestions?
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Mayayana
2011-05-22 03:27:04 UTC
Permalink
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 could have sworn I remembered you saying you were
going to get yourself a copy of the WMI help file. :)
GS
2011-05-22 04:49:33 UTC
Permalink
Post by Mayayana
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.
Post by Mayayana
( 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
GS
2011-05-22 04:58:00 UTC
Permalink
..The only thing I've seen from "DiskDrive" that appears
anywhere in Windows UI is "DiskDrive.Name [Model]"...
Typo...

The above should read:

..anywhere in Windows UI is "DiskDrive.Caption [Model]"

where Caption or Model contains the same value.
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
GS
2011-05-22 06:07:20 UTC
Permalink
I've determined that WMI Win32_DiskDrive provides the Index for each
drive. Also, I can filter it on InterfaceType "USB".

The Index appears to be the drive's position in the Drives enumerated
by "DiskDrive" according to the order the drives were 'plugged in'.
This indexing appears to not include "CD-ROM" drives.

I need to test this on several machines but it seems feasible to use
FSO to iterate its Drives collection and filter for DriveType "1,2" and
put the DriveLetter into an array. Then build the target drives path by
getting the drive letter from the array using "DiskDrive.Index".

Does anyone foresee any pitfalls in the solution?
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
MikeD
2011-05-22 13:02:40 UTC
Permalink
Post by GS
I've determined that WMI Win32_DiskDrive provides the Index for each
drive. Also, I can filter it on InterfaceType "USB".
The Index appears to be the drive's position in the Drives enumerated by
"DiskDrive" according to the order the drives were 'plugged in'. This
indexing appears to not include "CD-ROM" drives.
I need to test this on several machines but it seems feasible to use FSO
to iterate its Drives collection and filter for DriveType "1,2" and put
the DriveLetter into an array. Then build the target drives path by
getting the drive letter from the array using "DiskDrive.Index".
Does anyone foresee any pitfalls in the solution?
Besides using FSO? Consider using GetLogicalDrives or
GetLogicalDriveStrings and GetDriveType Win32 API functions. You might also
be able to use DeviceIoControl or some other API function rather than WMI.
As Mayanana said, WMI is a service and there is always a risk that it's been
disabled or otherwise not running.

You might want to explain in more detail what you're really doing all this
for. So far, you've only said "I was looking for a way to let users choose
a removeable drive to install an app that requires portable licensing to
work with the USB device". I have no idea what that means and I'd guess
nobody else does either. There might very well be an entirely different, and
better, approach to doing whatever it is.
--
Mike
GS
2011-05-22 18:29:58 UTC
Permalink
I've determined that WMI Win32_DiskDrive provides the Index for each drive.
Also, I can filter it on InterfaceType "USB".
The Index appears to be the drive's position in the Drives enumerated by
"DiskDrive" according to the order the drives were 'plugged in'. This
indexing appears to not include "CD-ROM" drives.
I need to test this on several machines but it seems feasible to use FSO to
iterate its Drives collection and filter for DriveType "1,2" and put the
DriveLetter into an array. Then build the target drives path by getting the
drive letter from the array using "DiskDrive.Index".
Does anyone foresee any pitfalls in the solution?
Besides using FSO? Consider using GetLogicalDrives or GetLogicalDriveStrings
and GetDriveType Win32 API functions. You might also be able to use
DeviceIoControl or some other API function rather than WMI. As Mayanana said,
WMI is a service and there is always a risk that it's been disabled or
otherwise not running.
Thanks, Mike. Yes, I was looking for an API alternative here. I agree
with Mayayana about using WMI service and so is why I started this
post.

I'll look at the APIs you suggested and see if they will meet my needs.
You might want to explain in more detail what you're really doing all this
for. So far, you've only said "I was looking for a way to let users choose a
removeable drive to install an app that requires portable licensing to work
with the USB device". I have no idea what that means and I'd guess nobody
else does either. There might very well be an entirely different, and better,
approach to doing whatever it is.
Some of my apps can be 'portable' in that they can be
installed/licensed to a USB memstik or USB external drive. It's a
hardware locked licensing scheme I use and so I need to get USB Device
info from the target drive. Going this route is at the user's option
and so they must select the USB drive they wish to use. (My licensing
scheme allows for 2 'seats' by default<g>)
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
MikeD
2011-05-22 21:01:16 UTC
Permalink
Some of my apps can be 'portable' in that they can be installed/licensed
to a USB memstik or USB external drive. It's a hardware locked licensing
scheme I use and so I need to get USB Device info from the target drive.
Going this route is at the user's option and so they must select the USB
drive they wish to use. (My licensing scheme allows for 2 'seats' by
default<g>)
So tell me (us) if I have this correct:

*Basically*, your app exists on removable media and the licensing (which I'm
assuming means your app is at least less functional if not licensed) needs
to be "valid" regardless of what computer that specific removeable media is
attached to.

Is that close? If so, that's really kind of a bizarre licensing scheme. And
if that's close, I do actually have some rough ideas. But obviously don't
know if they'd suit your needs. Before presenting them, I'd like
confirmation that I'm understanding your situation (because otherwise,
they're moot ideas).
--
Mike
GS
2011-05-22 22:28:44 UTC
Permalink
Post by MikeD
Some of my apps can be 'portable' in that they can be installed/licensed to
a USB memstik or USB external drive. It's a hardware locked licensing
scheme I use and so I need to get USB Device info from the target drive.
Going this route is at the user's option and so they must select the USB
drive they wish to use. (My licensing scheme allows for 2 'seats' by
default<g>)
*Basically*, your app exists on removable media and the licensing (which I'm
assuming means your app is at least less functional if not licensed) needs to
be "valid" regardless of what computer that specific removeable media is
attached to.
Is that close? If so, that's really kind of a bizarre licensing scheme. And
if that's close, I do actually have some rough ideas. But obviously don't
know if they'd suit your needs. Before presenting them, I'd like confirmation
that I'm understanding your situation (because otherwise, they're moot
ideas).
That's pretty close, Mike. The licensing scheme only prevents the app
from running on any other removable drive. So in effect, it simulates a
'roam license' without the need for live activation every time it's
used. If you think of the USB drive as a hardware 'dongle' then include
that the app is on it, then you've got the picture.

What I need is to service this scenario...

My app provides the option for users to create a 'roam license' only if
their app is already installed and licensed to a PC.

This obviates the need for a 'trial' version in a 'roam' profile
since the PC installed as a trial and, if licensed, user doesn't
need another trial of the same app.
(Thus the default 2-seats allowed with a valid license)
(Multi-seat licensing is also supported)

The app prompts the user to 'plug in' the target USB drive, and click
OK after it's connected.

The user is then presented with a dialog listing all valid candidate
USB drives where the user selects the one they want to use.

The app then prepares a folder on the target USB drive and copies all
app files to there, along with a set of encrypted 'license' files.

When the folder is set up and ready to use, the user is prompted to
register the new install to activate the license. This opens my
UserGuide to the reg.htm for the subject app, where they fill out the
reg info and 'Submit'. This, in turn, sends me an email with all the
reg/license info. I process that into a new license string and compile
a LicenseKey_<SeatID>.EXE to email back to the user with instruction to
save it to the app folder on the target drive and run it there.

The app won't run on the USB drive until its license is 'activated'.

The user can initially install the app to a USB drive attached to their
PC and license it to that PC. It will run as long as it's being used on
that PC. Moving the USB drive to another PC causes startup to abort as
it can't validate the license because it doesn't have a 'roam license'
profile. As a result, it tries to validate against the host PC's
validation info and fails.

The info I need to collect to make this 'roam' thing work for both
drive types 2,3 is...

PnPDeviceID, Drive Index, Total Size, Drive Letter

I'd be happy to entertain any suggestions you might have!
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
GS
2011-05-22 22:29:48 UTC
Permalink
BTW
How were you able to boldface in your post?
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Dee Earley
2011-05-23 09:54:13 UTC
Permalink
Post by GS
BTW
How were you able to boldface in your post?
Some clients treat *asterisks* as bold markers.
Some also honour _underscores_ for underlining.
--
Dee Earley (***@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
Jim Mack
2011-05-23 13:33:26 UTC
Permalink
Post by Dee Earley
Post by GS
BTW
How were you able to boldface in your post?
Some clients treat *asterisks* as bold markers.
Some also honour _underscores_ for underlining.
And those often also respect /slashes/ for /italics/
--
Jim
Helmut_Meukel
2011-05-23 15:48:37 UTC
Permalink
Post by Jim Mack
Post by Dee Earley
Post by GS
BTW
How were you able to boldface in your post?
Some clients treat *asterisks* as bold markers.
Some also honour _underscores_ for underlining.
And those often also respect /slashes/ for /italics/
Problems may arise if if the bold, underscored or italic text is
abbreviated as in /lat./ vs. /latin/.

Helmut.
Helmut_Meukel
2011-05-23 16:00:58 UTC
Permalink
Post by Helmut_Meukel
Post by Jim Mack
Post by Dee Earley
Post by GS
BTW
How were you able to boldface in your post?
Some clients treat *asterisks* as bold markers.
Some also honour _underscores_ for underlining.
And those often also respect /slashes/ for /italics/
Problems may arise if if the bold, underscored or italic text is
abbreviated as in /lat./ vs. /latin/.
My newsreader didn't interpret the slash after the dot of lat. as
end of italics and diplayed it instead; and then - because it displayed
still italics - displayed the slash before latin, too.
(I use MesNews). How did other Newsreaders?

Helmut.
Dee Earley
2011-05-24 09:44:38 UTC
Permalink
Post by Helmut_Meukel
Post by Helmut_Meukel
Post by Jim Mack
Post by Dee Earley
Post by GS
BTW
How were you able to boldface in your post?
Some clients treat *asterisks* as bold markers.
Some also honour _underscores_ for underlining.
And those often also respect /slashes/ for /italics/
Problems may arise if if the bold, underscored or italic text is
abbreviated as in /lat./ vs. /latin/.
My newsreader didn't interpret the slash after the dot of lat. as
end of italics and diplayed it instead; and then - because it displayed
still italics - displayed the slash before latin, too.
(I use MesNews). How did other Newsreaders?
Thunderbird (3.1.10) handled it fine.
--
Dee Earley (***@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
MikeD
2011-05-23 12:51:23 UTC
Permalink
Post by GS
BTW
How were you able to boldface in your post?
I didn't know I had. I see it, and posted it as, plain text.
--
Mike
GS
2011-05-23 14:48:30 UTC
Permalink
Post by GS
BTW
How were you able to boldface in your post?
Okay, thanks to all!
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Mayayana
2011-05-22 13:23:09 UTC
Permalink
I found the answer, but it's very ugly:

http://www.vistax64.com/powershell/125429-associating-wmi-disk-classes.html

It turns out that you need to connect the disk IDs to
the logical partitions with Win32_LogicalDiskToPartition
using "ASSOCIATORS OF"
GS
2011-05-22 18:36:34 UTC
Permalink
Post by Mayayana
http://www.vistax64.com/powershell/125429-associating-wmi-disk-classes.html
It turns out that you need to connect the disk IDs to
the logical partitions with Win32_LogicalDiskToPartition
using "ASSOCIATORS OF"
Hmm! I'm actually looking to get away from WMI and was hoping to be
able to go with APIs. Sorry if I wasn't clear about that when I said
"I'm not looking for WMI help here". I certainly do appreciate your
effort, though, and so I won't let that go to waste. I did run a script
on Win32_LogicalDiskToPartion but didn't easily find what I was looking
for. I'll take another look after I view the webpage you posted a link
to.

Also, I'll explore the APIs MikeD mentioned.

Thanks so much...
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
GS
2011-05-22 18:49:34 UTC
Permalink
Post by Mayayana
http://www.vistax64.com/powershell/125429-associating-wmi-disk-classes.html
It turns out that you need to connect the disk IDs to
the logical partitions with Win32_LogicalDiskToPartition
using "ASSOCIATORS OF"
Geez.., how did I miss this the 1st time? Win32_LogicalDiskToPartition
returns both the drive index# AND its drive letter. So parsing the info
from the returned strings can be used with Win32_DiskDrive to
associated by index.

This will work for now, until I get a pure VB (+API) solution not
dependant on the WMI service. Big thanks to you, Mayayana!
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
GS
2011-05-22 20:26:39 UTC
Permalink
I guess some people just like doing things the hard way. Here's how I
did it...

Sub List_AllDrives()
' Lists all drives as <Index>:<DriveLetter>

Dim oWMI, vDrives, vDrv, aDrvs(), s1, s2, i, iPos

On Error GoTo ErrorExit
Set oWMI = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set vDrives = _
oWMI.ExecQuery("Select * from Win32_LogicalDiskToPartition")

i = 0
For Each vDrv In vDrives
s1 = vDrv.Antecedent: iPos = InStr(1, s1, "#")
s1 = Mid$(s1, iPos + 1, InStr(1, s1, ",") - (iPos + 1)) '//index

s2 = vDrv.Dependent: iPos = InStr(1, s2, "=")
s2 = Mid$(s2, iPos + 2, 1) '//drive letter

ReDim Preserve aDrvs(0 To i): aDrvs(i) = s1 + ":" + s2: i = i + 1
Next

' For i = LBound(aDrvs) To UBound(aDrvs): Debug.Print aDrvs(i): Next

ErrorExit:
Set oWMI = Nothing: Set vDrives = Nothing
End Sub 'List_AllDrives

Now, all I have to do is use the index to associate drive letter to
DiskDrive!
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Mayayana
2011-05-22 22:29:51 UTC
Permalink
|
| I guess some people just like doing things the hard way. Here's how I
| did it...
|

Interesting. It works fine. I had tried using
Win32_LogicalDiskToPartition at first and got an error
that it "isn't a collection". I must have had a typo
because your code works fine for me.
GS
2011-05-22 22:33:36 UTC
Permalink
Post by Mayayana
Post by GS
I guess some people just like doing things the hard way. Here's how I
did it...
Interesting. It works fine. I had tried using
Win32_LogicalDiskToPartition at first and got an error
that it "isn't a collection". I must have had a typo
because your code works fine for me.
I'm glad! It's a lot simpler approach than what was detailed in that
html, huh?
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Mayayana
2011-05-22 22:36:35 UTC
Permalink
I also took a look at the API calls that Mike mentioned,
as well as GetVolumeInformation, but I don't see anything
there that will distinguish a USB drive. That may be
functionality that's only in the WMI drivers.
GS
2011-05-22 22:49:24 UTC
Permalink
Post by Mayayana
I also took a look at the API calls that Mike mentioned,
as well as GetVolumeInformation, but I don't see anything
there that will distinguish a USB drive. That may be
functionality that's only in the WMI drivers.
Yeah, I'm reaching the same conclusion. GetVolumeInformation is where I
started looking before Mike posted. I'm sure there's an API that will
determine interface type; after all, how does WMI do it if not via
APIs?

I've also got Brad Martinez's VB Explorer project and thought I'd
browse it for APIs that might work.

What would also help is a comprehensive list of drive info
enums/constants to work with. I can also read Dan Appleman's VB/API
guide for answers.
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Mayayana
2011-05-23 00:48:20 UTC
Permalink
| I'm sure there's an API that will
| determine interface type; after all, how does WMI do it if not via
| APIs?
|

I think WMI has its own drivers for handling hardware.
Ever since WMI came out, a lot of tweak programs and
hardware info. programs use WMI to return system info.
....which in my experience is about all that WMI *is*
useful for.
GS
2011-05-23 01:30:51 UTC
Permalink
Post by Mayayana
Post by GS
I'm sure there's an API that will
determine interface type; after all, how does WMI do it if not via
APIs?
I think WMI has its own drivers for handling hardware.
Ever since WMI came out, a lot of tweak programs and
hardware info. programs use WMI to return system info.
....which in my experience is about all that WMI *is*
useful for.
I shall persist to move forward relentlessly!<bg>

Thanks so much for your help...
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
MikeD
2011-05-21 23:42:59 UTC
Permalink
Post by GS
I'm looking for a VB solution to put a value into a logical drive's
StatusInfo property. I've tried using FSO but can't seem to be able to
make it work due to not having any info for proper syntax to write. (Never
did this before; just read only)
What I'm trying to do is place a temporary 'tag' on a specific drive so I
can query the value via WMI Win32_DiskDrive.
Any help/direction would be most appreciated.
Any reason you can't just write this temporary "tag" to a temporary file?
Seems to me like that'd be a lot easier.
--
Mike
GS
2011-05-22 00:14:40 UTC
Permalink
Post by MikeD
Any reason you can't just write this temporary "tag" to a temporary file?
Seems to me like that'd be a lot easier.
That's what Mayayana suggested, but won't work for what I'm trying to
do. I need some way to associate a Drive letter to a disk found via WMI
Win32_DiskDrive. This class returns the Model info as listed in the
Hardware list of a properties dialog. What I need is a way to get a
path from a selected drive list of only drives with InterfaceType
"USB".

Is there a WMI class that lists hardware Model AND specifies its drive
letter (if a drive)?
--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
GS
2011-05-23 17:20:12 UTC
Permalink
It looks like I'm stuck with using WMI for now. I've been able to
reduce the calls to 1x for 2 classes: DiskDrive &
LogicalDiskToPartition.

I make the first call to LogicalDiskToPartition, loading the results
(Index,DriveLetter) into an array (saLDTP()).

I then pass the array to my proc that lists all drives with
InterfaceType "USB" via DiskDrive. For each drive found it loops saLDTP
to match the drive's Index so it can grab the DriveLetter. This is not
necessarily going to be the index of the array element since there'll
be one element for each partition on each drive. I can exit the loop at
the first match found and move to the next drive (if there's more).

The DriveLetter and Caption are then put into a 3 column listbox, of
which only 2 columns are visible. (The 3rd column holds the other data
I need for processing my license key)

Once the user selects a drive, all its info is grabbed from the list
and processed:

- I have the target drive
- I have the Caption for the progress bar form
- I have the hardware *seat* portion of the license string

That appears to be as simple as it gets since there doesn't appear to
be an API solution at present. If anyone sees any pitfalls in this
approach I'd appreciate hearing from you.

Large thanks to MikeD and Mayayana for your contributions!
--
Garry

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