Announcement

Collapse
No announcement yet.

search all HD and USB Drives

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pierre Bellisle
    replied
    These might help you...

    User to user discussions of general programming topics such as algorithms, APIs, etc.

    User to user discussions about the PB/Win (formerly PB/DLL) product line. Discussion topics include PowerBASIC Forms, PowerGEN and PowerTree for Windows.

    Leave a comment:


  • Kev Peel
    replied
    I suppose Mark's first sentence wasn't 100% clear. People who do not have a good grasp of the API would not know where to start, thus no code will be shown.

    In this case, the question was fairly easy. I even took the code from a previous post I located via POFFS:

    Last edited by Kev Peel; 6 May 2008, 10:28 AM.

    Leave a comment:


  • Michael Mattias
    replied
    Silly me.

    I mistook "My APP looks for it and finds it " as "My APP looks for it and finds it."

    Guess I should have studied the posted code more carefully, huh?

    Leave a comment:


  • Kev Peel
    replied
    I took \\usbdrive\myfile.dat to mean a placeholder.

    Leave a comment:


  • Kev Peel
    replied
    This code will return all drives present. Removable drives such as Floppy, CD-ROM/DVD or USB sticks are reported as DRIVE_REMOVABLE. I would check for all drives of this type but skip drive A:\, this would be acceptable in most cases.

    Code:
    #Compile Exe
    #Dim All
    #Include "win32api.inc"
    Function PBMain
     
      Local i As Long
      Local sDrives As String
      Local szType As Asciiz * 128
     
      sDrives = String$(GetLogicalDriveStrings(0, ByVal %Null), $Nul)
      GetLogicalDriveStrings Len(sDrives), ByVal StrPtr(sDrives)
      sDrives = RTrim$(sDrives, $Nul)
     
      For i = 1 To ParseCount(sDrives, $Nul)
          Select Case Const GetDriveType(Parse$(sDrives, $Nul, i))
                 Case %DRIVE_UNKNOWN: szType = "DRIVE_UNKNOWN"
                 Case %DRIVE_NO_ROOT_DIR: szType = "DRIVE_NO_ROOT_DIR"
                 Case %DRIVE_REMOVABLE: szType = "DRIVE_REMOVABLE"
                 Case %DRIVE_FIXED: szType = "DRIVE_FIXED"
                 Case %DRIVE_REMOTE: szType = "DRIVE_REMOTE"
                 Case %DRIVE_CDROM: szType = "DRIVE_CDROM"
                 Case %DRIVE_RAMDISK: szType = "DRIVE_RAMDISK"
                 Case Else: szType = "Unknown type"
          End Select
          MsgBox Parse$(sDrives, $Nul, i) + $CrLf + "Drive Type: " + szType, , "Drive Number #" + Format$(i)
      Next i
     
    End Function

    Leave a comment:


  • Michael Mattias
    replied
    You said you found "\\usbdrive" !!!

    Try that in your OPEN - just like I typed it!!!

    Leave a comment:


  • Mark A Nelson
    replied
    How do I know what drive to use?

    Leave a comment:


  • Michael Mattias
    replied
    What happened when you tried...
    Code:
    open "\\usbDrive\myfile.dat" FOR INPUT AS #6742
    ...????

    Then again, if your user has to insert the thing, he or she must be there and you could prompt them for a drive letter.

    Leave a comment:


  • Mark A Nelson
    started a topic search all HD and USB Drives

    search all HD and USB Drives

    What I would like to do is when a users put in a USB Drive. My APP looks for it and finds it , Search \\usbdrive\myfile.dat. But I am missing the boat here. I never know what drive letter it will be? So can't put f:\ or h:\ cause I never know what letter it will be..
Working...
X
😀
🥰
🤢
😎
😡
👍
👎