QB64 Phoenix Edition
Volume display utility - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: Volume display utility (/showthread.php?tid=2050)



Volume display utility - eoredson - 09-30-2023

I have been using FindFirst for awhile and found FindFirstVolume in MSDN which is here:

Code: (Select All)
Const MAX_PATH = 260
Const INVALID_HANDLE_VALUE = -1
Declare Dynamic Library "kernel32"
    Function FindFirstVolumeW~%& (ByVal lpFileName~%&, MAX_PATH)
    Function FindNextVolumeW& (ByVal hFindFile~%&, Byval hFindPoint~%&, MAX_PATH)
    Function FindVolumeClose& (ByVal hFindFile~%&)
End Declare

Dim ASCIIZ As String * 260
Dim Wfile.Handle As _Unsigned _Offset

' find first long filename
Wfile.Handle = FindFirstVolumeW(_Offset(ASCIIZ), MAX_PATH)

' check findirst error
If Wfile.Handle <> INVALID_HANDLE_VALUE Then
    ' filename/directory loop
    Do
        X$ = ASCIIZ
        Do
            X = InStr(X$, Chr$(0))
            If X Then
                X$ = Left$(X$, X - 1) + Mid$(X$, X + 1)
            Else
                Exit Do
            End If
        Loop
        Print X$
    Loop While FindNextVolumeW(Wfile.Handle, _Offset(ASCIIZ), MAX_PATH)
    X = FindVolumeClose(Wfile.Handle)
End If
End
but I don't understand the output.

Erik.