|
Post by James Grubbs (Jimmy) on Sept 23, 2021 15:35:58 GMT -5
I am looking for a way to capture the GUID of a flash drive. Any help on this would be appreciated.
|
|
|
Post by Brandon Parker on Sept 23, 2021 17:11:24 GMT -5
Have you checked out GetVolumeNameForVolumeMountPointA() on MSDN? Here is an example that seems to work for me. Print GetUSBGUID$("D:\") 'Your drive letter goes here!!!!
Function GetUSBGUID$(lpszVolumeMountPoint$) lpszVolumeMountPoint$ = lpszVolumeMountPoint$ + chr$(0) lpszVolumeName$ = Space$(50) cchBufferLength = Len(lpszVolumeName$) CallDLL #kernel32, "GetVolumeNameForVolumeMountPointA", lpszVolumeMountPoint$ As ptr, _ lpszVolumeName$ As ptr, _ cchBufferLength As ulong, _ getUSBGUID As long If getUSBGUID Then GetUSBGUID$ = UpTo$(AfterLast$(lpszVolumeName$, "Volume{"), "}") Else GetUSBGUID$ = "INVALID" End If End Function {:0) Brandon Parker
|
|
|
Post by James Grubbs (Jimmy) on Sept 23, 2021 22:38:18 GMT -5
I hadn't until now. Your sample code works perfectly. Thank You very much!
|
|
|
Post by Brandon Parker on Sept 24, 2021 15:33:07 GMT -5
Glad to help!!
There are always obscure functions hiding in the Windows API. I always find something new when I go looking...
{:0)
Brandon Parker
|
|