Loading ...
Sorry, an error occurred while loading the content.

Re: [libertybasic] Drives$

Expand Messages
  • Alyce Watson
    ... lpBuffer$=space$(100)+chr$(0) nBufferLength=len(lpBuffer$)-1 calldll #kernel32, GetLogicalDriveStringsA ,_ nBufferLength as ulong,_ size of buffer
    Message 1 of 13 , Oct 2, 2002
    • 0 Attachment
      At 08:38 AM 10/2/2002 +0000, you wrote:
      > Im assuming that this variable is gathered by a windows call. It
      >works great except for one understandable glitch....it appears to
      >only log the drives that were available at the start of the lb
      >program...if you have a usb drive, it may not still be available
      >later on and Drives$ doesnt seem to recognize that. If it was a
      >windows call, what is the call? The systems im trying to write for
      >may not always have the same drives in mid lb program, i need to
      >know how to gather the available drives "on the fly".



      lpBuffer$=space$(100)+chr$(0)
      nBufferLength=len(lpBuffer$)-1

      calldll #kernel32, "GetLogicalDriveStringsA",_
      nBufferLength as ulong,_ 'size of buffer
      lpBuffer$ as ptr,_ 'address of buffer for drive strings
      result as ulong 'needed length of buffer, if not large enough

      if result>nBufferLength then
      print "Need larger buffer, length: ";result
      else
      print "Drives:"
      i=1 'initialize counter variable
      while word$(lpBuffer$,i)<>""
      print word$(lpBuffer$,i)
      i=i+1
      wend
      end if

      print:print "Done"
    • dirtbottom@starband.net
      Does anyone know if there is anything special about the system variable Drives$? If I make a successful drive mount with a DefineDosDeviceA dll call then print
      Message 2 of 13 , Jun 6, 2004
      • 0 Attachment
        Does anyone know if there is anything special about the system
        variable Drives$?
        If I make a successful drive mount with a DefineDosDeviceA dll call
        then print out the Drives$ variable it doesn't show the new drive. If
        I close the program down and rerun it, it shows the updated Drives$.
        Is there anything that needs to be done to have the Drives$ updated
        either by dll or any other way?
        Appreciate any pointers,
        Gary
      • bertvanderveen
        Good evening, I do have a question about the statement Drives$ It is working fine but when i use it repeatly it gives always the same string, even if i put my
        Message 3 of 13 , Jan 14, 2006
        • 0 Attachment
          Good evening,

          I do have a question about the statement Drives$
          It is working fine but when i use it repeatly
          it gives always the same string,
          even if i put my mem.stick in or out.
          if i end the program and run it again then the new drive
          is seen corr.

          Greetings and thanks for reading this

          Bert
        • Chergarj@cs.com
          The variable, Drive$, contains information about your computer. Specifically, its value is the list of disc drives on your computer. G C In a
          Message 4 of 13 , Jan 14, 2006
          • 0 Attachment
            The variable, Drive$, contains information about your computer.
            Specifically, its value is the list of disc drives on your computer.

            G C

            In a message dated 01/14/2006 3:35:51 PM Pacific Standard Time,
            gavanderveen@... writes:
            > I do have a question about the statement Drives$
            > It is working fine but when i use it repeatly
            > it gives always the same string,
            > even if i put my mem.stick in or out.
            > if i end the program and run it again then the new drive
            > is seen corr.
            >


            [Non-text portions of this message have been removed]
          • Chergarj@cs.com
            The correct variable name is Drives$ I misspelled it in my previous messae. Also, Check the helpfile for Drives$ in the index. G C In a
            Message 5 of 13 , Jan 14, 2006
            • 0 Attachment
              The correct variable name is Drives$

              I misspelled it in my previous messae. Also, Check the helpfile for Drives$
              in the index.

              G C

              In a message dated 01/14/2006 3:51:34 PM Pacific Standard Time,
              Chergarj@... writes:
              > The variable, Drive$, contains information about your computer.
              > Specifically, its value is the list of disc drives on your computer.
              >
              > G C


              [Non-text portions of this message have been removed]
            • Ron Spruell
              Here is an example right out of the liberty basic program see if this differs from what you have? It appears to work for me. You can expand on the selection to
              Message 6 of 13 , Jan 14, 2006
              • 0 Attachment
                Here is an example right out of the liberty basic program see if this
                differs from what you have? It appears to work for me. You can expand on the
                selection to do what every you want. Keep in mind this is an example program
                from Liberty Basic not mine but if you see a problem with it their will be
                folks to help you.



                Ron Spruell



                'a simple example illustrating the use of the Drives$ variable

                dim letters$(25)

                index = 0

                while word$(Drives$, index + 1) <> ""

                letters$(index) = word$(Drives$, index + 1)

                index = index + 1

                wend

                statictext #choose, "Double-click to pick a drive:", 10, 10, 200, 20

                listbox #choose.list, letters$(, [selectionMade], 10, 35, 100, 150

                open "Scan drive" for dialog as #choose

                print #choose, "trapclose [quit]"

                wait



                [selectionMade]

                print #choose.list, "selection? whatsIt$"

                notice "You selected drive "; whatsIt$



                [quit]

                close #choose

                end







                SECURITY MESSAGE:



                If this E-Mail mesage was not intended for you please delete the E-Mail
                from Ron Spruell and inform your ISP provider or system manager of the
                problem.



                Ron Spruell

                321 Highlander Court

                Hueytown Alabama 35023-2714

                Phone 1-205-497-0173 FAX 1-205-497-0173

                Cell 1-205-427-2203

                _____

                From: libertybasic@yahoogroups.com [mailto:libertybasic@yahoogroups.com] On
                Behalf Of bertvanderveen
                Sent: Saturday, January 14, 2006 5:35 PM
                To: libertybasic@yahoogroups.com
                Subject: [libertybasic] Drives$



                Good evening,

                I do have a question about the statement Drives$
                It is working fine but when i use it repeatly
                it gives always the same string,
                even if i put my mem.stick in or out.
                if i end the program and run it again then the new drive
                is seen corr.

                Greetings and thanks for reading this

                Bert








                _____

                YAHOO! GROUPS LINKS



                * Visit your group "libertybasic
                <http://groups.yahoo.com/group/libertybasic> " on the web.

                * To unsubscribe from this group, send an email to:
                libertybasic-unsubscribe@yahoogroups.com
                <mailto:libertybasic-unsubscribe@yahoogroups.com?subject=Unsubscribe>

                * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                <http://docs.yahoo.com/info/terms/> Service.



                _____



                [Non-text portions of this message have been removed]
              • Alyce Watson
                ... It looks like the variable is being filled when the program starts and Liberty BASIC does not check the available drives again during the program s run.
                Message 7 of 13 , Jan 14, 2006
                • 0 Attachment
                  At 05:35 PM 1/14/2006, you wrote:
                  >I do have a question about the statement Drives$
                  >It is working fine but when i use it repeatly
                  >it gives always the same string,
                  >even if i put my mem.stick in or out.
                  >if i end the program and run it again then the new drive
                  >is seen corr.

                  It looks like the variable is being filled when the program starts
                  and Liberty BASIC does not check the available drives again during
                  the program's run.

                  This API function returns the drives currently installed. The
                  returned string lists the drive letters, separated by null
                  characters. You'll have to parse the string, or use instr() to get
                  the drive letters.

                  -Alyce

                  d$ = space$(255)
                  calldll #kernel32, "GetLogicalDriveStringsA",255 as ulong, d$ as ptr,
                  re as ulong
                  print "return string is ";d$




                  --
                  No virus found in this outgoing message.
                  Checked by AVG Anti-Virus.
                  Version: 7.1.371 / Virus Database: 267.14.17/229 - Release Date: 1/13/2006
                • Ron Spruell
                  Thanks Alyce I saved that one. It works well. I plugged my pen drive into the USB port and it detected it but so did the other program. Of course I just used
                  Message 8 of 13 , Jan 14, 2006
                  • 0 Attachment
                    Thanks Alyce I saved that one. It works well. I plugged my pen drive into
                    the USB port and it detected it but so did the other program. Of course I
                    just used the little program by it's self and every time it quit and I had
                    to re-run it. If I had this in a running program I would have seen the
                    difference.



                    SECURITY MESSAGE:



                    If this E-Mail mesage was not intended for you please delete the E-Mail
                    from Ron Spruell and inform your ISP provider or system manager of the
                    problem.



                    Ron Spruell

                    321 Highlander Court

                    Hueytown Alabama 35023-2714

                    Phone 1-205-497-0173 FAX 1-205-497-0173

                    Cell 1-205-427-2203

                    _____

                    From: libertybasic@yahoogroups.com [mailto:libertybasic@yahoogroups.com] On
                    Behalf Of Alyce Watson
                    Sent: Saturday, January 14, 2006 7:12 PM
                    To: libertybasic@yahoogroups.com
                    Subject: Re: [libertybasic] Drives$



                    At 05:35 PM 1/14/2006, you wrote:
                    >I do have a question about the statement Drives$
                    >It is working fine but when i use it repeatly
                    >it gives always the same string,
                    >even if i put my mem.stick in or out.
                    >if i end the program and run it again then the new drive
                    >is seen corr.

                    It looks like the variable is being filled when the program starts
                    and Liberty BASIC does not check the available drives again during
                    the program's run.

                    This API function returns the drives currently installed. The
                    returned string lists the drive letters, separated by null
                    characters. You'll have to parse the string, or use instr() to get
                    the drive letters.

                    -Alyce

                    d$ = space$(255)
                    calldll #kernel32, "GetLogicalDriveStringsA",255 as ulong, d$ as ptr,
                    re as ulong
                    print "return string is ";d$




                    --
                    No virus found in this outgoing message.
                    Checked by AVG Anti-Virus.
                    Version: 7.1.371 / Virus Database: 267.14.17/229 - Release Date: 1/13/2006




                    _____

                    YAHOO! GROUPS LINKS



                    * Visit your group "libertybasic
                    <http://groups.yahoo.com/group/libertybasic> " on the web.

                    * To unsubscribe from this group, send an email to:
                    libertybasic-unsubscribe@yahoogroups.com
                    <mailto:libertybasic-unsubscribe@yahoogroups.com?subject=Unsubscribe>

                    * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                    <http://docs.yahoo.com/info/terms/> Service.



                    _____



                    [Non-text portions of this message have been removed]
                  • Brent Thorn
                    Ron, If you need your app to know when you insert or remove a drive, I have a snip on my site at . It requires my WMLiberty DLL to trap
                    Message 9 of 13 , Jan 15, 2006
                    • 0 Attachment
                      Ron, If you need your app to know when you insert or remove a drive, I
                      have a snip on my site at <http://www.b6sw.com/>. It requires my
                      WMLiberty DLL to trap the WM_DEVICECHANGE event.

                      Brent

                      --- In libertybasic@yahoogroups.com, "Ron Spruell" <spruell9@b...>
                      wrote:
                      >
                      > Thanks Alyce I saved that one. It works well. I plugged my pen drive
                      > into the USB port and it detected it but so did the other program. Of
                      > course I just used the little program by it's self and every time it
                      > quit and I had to re-run it. If I had this in a running program I
                      > would have seen the difference.
                    • Ron Spruell
                      Thanks I will go up and look at it. Is the dll obvious or will I have to go to a sub director to find it? Finding out how many and what drives can be very
                      Message 10 of 13 , Jan 15, 2006
                      • 0 Attachment
                        Thanks I will go up and look at it. Is the dll obvious or will I have to go
                        to a sub director to find it? Finding out how many and what drives can be
                        very important to large programs. I just program programs for my own use and
                        for my children. They sometimes have a need for a program that does just one
                        little thing and if they bought a program that did what they want it would
                        cost a lot besides having a lot of bloatware they nor I need.



                        Ron Spruell



                        SECURITY MESSAGE:



                        If this E-Mail mesage was not intended for you please delete the E-Mail
                        from Ron Spruell and inform your ISP provider or system manager of the
                        problem.



                        Ron Spruell

                        321 Highlander Court

                        Hueytown Alabama 35023-2714

                        Phone 1-205-497-0173 FAX 1-205-497-0173

                        Cell 1-205-427-2203

                        _____

                        From: libertybasic@yahoogroups.com [mailto:libertybasic@yahoogroups.com] On
                        Behalf Of Brent Thorn
                        Sent: Sunday, January 15, 2006 3:08 AM
                        To: libertybasic@yahoogroups.com
                        Subject: [libertybasic] Re: Drives$



                        Ron, If you need your app to know when you insert or remove a drive, I
                        have a snip on my site at <http://www.b6sw.com/>. It requires my
                        WMLiberty DLL to trap the WM_DEVICECHANGE event.

                        Brent

                        --- In libertybasic@yahoogroups.com, "Ron Spruell" <spruell9@b...>
                        wrote:
                        >
                        > Thanks Alyce I saved that one. It works well. I plugged my pen drive
                        > into the USB port and it detected it but so did the other program. Of
                        > course I just used the little program by it's self and every time it
                        > quit and I had to re-run it. If I had this in a running program I
                        > would have seen the difference.







                        _____

                        YAHOO! GROUPS LINKS



                        * Visit your group "libertybasic
                        <http://groups.yahoo.com/group/libertybasic> " on the web.

                        * To unsubscribe from this group, send an email to:
                        libertybasic-unsubscribe@yahoogroups.com
                        <mailto:libertybasic-unsubscribe@yahoogroups.com?subject=Unsubscribe>

                        * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                        <http://docs.yahoo.com/info/terms/> Service.



                        _____



                        [Non-text portions of this message have been removed]
                      • Brent Thorn
                        Hi Ron, ... I think it s fairly obvious. Just click on DLLs from almost any page on the site. I d give out a URL but I m going to redo the site sometime and
                        Message 11 of 13 , Jan 15, 2006
                        • 0 Attachment
                          Hi Ron,

                          --- In libertybasic@yahoogroups.com, "Ron Spruell" <spruell9@b...>
                          wrote:
                          > Thanks I will go up and look at it. Is the dll obvious or will I
                          > have to go to a sub director to find it?
                          > [snip]

                          I think it's fairly obvious. Just click on "DLLs" from almost any page
                          on the site. I'd give out a URL but I'm going to redo the site sometime
                          and things will be changing.

                          Brent

                          * On the Web at http://www.b6sw.com/
                          * Interact at http://www.b6sw.com/forum/
                        • bbjen@hotPOP.com
                          Ron, I use this call to find the drive letter for a RamDrive. Bill J. [ramCheck] *** find ramDrive letter ramDrive$= : i = 1 d$=word$(Drives$,i) while
                          Message 12 of 13 , Jan 17, 2006
                          • 0 Attachment
                            Ron,
                            I use this call to find the drive letter for a RamDrive.
                            Bill J.

                            [ramCheck] '*** find ramDrive letter
                            ramDrive$="" : i = 1
                            d$=word$(Drives$,i)

                            while d$<>""
                            d$=word$(Drives$,i)
                            '*** check Function:
                            if GetDriveType(d$)=6 then ramDrive$=d$+"\"
                            i = i + 1
                            wend
                            if ramDrive$="" then
                            notice "No ramDrive present" :stop
                            else
                            print ramDrive$
                            end if
                            END

                            Function GetDriveType(dir$)
                            open "kernel32" For DLL As #k
                            callDLL #k, "GetDriveTypeA",_
                            dir$ As ptr,dType As long
                            close #k
                            GetDriveType=dType
                            ' dType = 0 (No Drive)
                            ' dType = 1 (Unknown Drive Type)
                            ' dType = 2 (Floppy Drive)
                            ' dType = 3 (Hard Drive)
                            ' dType = 4 (Remote Drive)
                            ' dType = 5 (CDROM)
                            ' dType = 6 (RAMDISK)
                            End Function
                          Your message has been successfully submitted and would be delivered to recipients shortly.