Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Drive Display
#2
A QBasic way...


Code: (Select All)
ON ERROR GOTO er1
FOR i = 1 TO 26
    drive$ = CHR$(i + 64)
    OPEN drive$ + ":\~.~" FOR INPUT AS #1: CLOSE #1
    IF found THEN
        IF found = 1 THEN PRINT drive$ ELSE PRINT drive$ + " not ready."
    END IF
NEXT
END

er1:
er% = ERR
SELECT CASE er%
    CASE 76
        ' Not found so do nothing.
        found = 0
    CASE 53
        found = 1
    CASE 68
        found = 2
END SELECT
RESUME NEXT

The "not ready" is going to be the optical drive if it does not contain media. Error 68 is drive not ready.

We can't use CHDIR as it will not differentiate a drive not ready, therefore it would not show the optical drive at all.

~.~ simply denotes a file name no one should have. It triggers the error 53, file not found, which we ignore. Error 76 is drive not found.

Pete
Shoot first and shoot people who ask questions, later.
Reply


Messages In This Thread
Simple Drive Display - by eoredson - 12-10-2022, 04:43 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 06:58 AM
RE: Simple Drive Display - by eoredson - 12-10-2022, 07:21 AM
RE: Simple Drive Display - by mnrvovrfc - 12-10-2022, 07:41 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 07:57 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 08:28 AM
RE: Simple Drive Display - by eoredson - 12-10-2022, 08:50 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 08:58 AM
RE: Simple Drive Display - by eoredson - 12-10-2022, 09:06 AM
RE: Simple Drive Display - by mnrvovrfc - 12-10-2022, 09:16 AM
RE: Simple Drive Display - by Pete - 12-10-2022, 05:39 PM
RE: Simple Drive Display - by eoredson - 12-11-2022, 02:43 AM
RE: Simple Drive Display - by mnrvovrfc - 12-11-2022, 08:20 AM
RE: Simple Drive Display - by eoredson - 12-11-2022, 03:00 AM
RE: Simple Drive Display - by Pete - 12-11-2022, 03:45 AM
RE: Simple Drive Display - by eoredson - 12-11-2022, 05:30 AM
RE: Simple Drive Display - by eoredson - 12-12-2022, 05:38 AM
RE: Simple Drive Display - by Pete - 12-12-2022, 06:10 AM
RE: Simple Drive Display - by SMcNeill - 12-12-2022, 06:22 AM
RE: Simple Drive Display - by eoredson - 12-13-2022, 05:53 AM
RE: Simple Drive Display - by SpriggsySpriggs - 12-13-2022, 03:00 PM
RE: Simple Drive Display - by Pete - 12-13-2022, 03:22 PM
RE: Simple Drive Display - by SpriggsySpriggs - 12-13-2022, 04:21 PM
RE: Simple Drive Display - by Pete - 12-13-2022, 04:33 PM
RE: Simple Drive Display - by SpriggsySpriggs - 12-13-2022, 06:09 PM
RE: Simple Drive Display - by Pete - 12-13-2022, 07:05 PM
RE: Simple Drive Display - by vince - 12-13-2022, 10:25 PM
RE: Simple Drive Display - by Pete - 12-13-2022, 10:46 PM



Users browsing this thread: 18 Guest(s)