Help with dos messages

 BBS: Inland Empire Archive
Date: 06-16-92 (08:43)             Number: 565
From: STEVE HALKO                  Refer#: NONE
  To: MARC JOHNSON                  Recvd: NO  
Subj: Help with dos messages         Conf: (2) Quik_Bas
MJ>Hello, i want to know how can i bypas the dos message frome QuickBasic?
MJ>I have only one disk drive(A:), and when i want to use drive B:
MJ>the DOS prompt the user to insert a diskette in drive B: and
MJ>then strike a key. I'd like to know if there is a way to bypass
MJ>this procedure because i have written a program using popup
MJ>windows in it. The problem is how can i trap the routine for a
MJ>diskette prompt.

  You can't really trap the drive B: prompt from QB.  What you must do
  is detect that situation before DOS even tries to access drive B.
  This function will detect how many floppy drives are on your system:

  FUNCTION OneFloppy%
  'This function returns TRUE (-1) on a one floppy system, and FALSE (0)
    DEF SEG = &H40
    OneFloppy% = ((PEEK(&H10) AND &HC1) = 1)

  Next, there's a flag at 0050:0004 which indicates whether drive A: or
  drive B: is the current floppy drive in a one floppy system:

  FUNCTION CurrentFloppy%
  'This function returns:  0 if the current floppy drive is A:
  '                        1 if the current floppy drive is B:
    DEF SEG =&H50
    CurrentFloppy% = PEEK(&H4)

  And here's an example using the above functions.  Here, the task is to
  ask the user for a disk drive, and then open a file (MYFILE.DAT) on
  that drive:

  DECLARE FUNCTION CurrentFloppy()
  PRINT "Enter Drive Letter (A-Z): ";
  DO                                     'Wait for a valid drive letter
    Drive$ = UCASE$(INKEY$)
  LOOP UNTIL (Drive$ > = "A") AND (Drive$ < = "Z")
  PRINT Drive$
  'If drive A or B in a one floppy system:
  IF (Drive$ < = "B") AND OneFloppy THEN
    IF (ASC(Drive$) - 65) XOR CurrentFloppy THEN  'If drive change
      PRINT "Insert diskette in drive "; Drive$; " and press any key."
      LOOP UNTIL LEN(INKEY$)      'Wait for a key press
      DEF SEG = &H50
      POKE &H4, ASC(Drive$) - 65  'Update current floppy flag
    END IF
  OPEN Drive$ + ":" + "MYFILE.DAT" FOR BINARY AS FileNr
  ' Do what you want here

 * SLMR 2.1a * If at first you don't succeed, skydiving is not for you!
--- DB B1073/002487
 * Origin: Gulf Coast BBS -QuickSHARE #2- (904)563-2547 HST/V.32bis (1:365/12)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET