Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/37346

From BetaArchive Wiki
Knowledge Base


RUN "PROG.EXE" Fails in QB.EXE Editor; Use RUN "PROG" Instead

Article ID: 37346

Article Last Modified on 11/21/2006



APPLIES TO

  • Microsoft QuickBasic 4.0, when used with:
    • Microsoft BASIC Compiler 6.0
    • Microsoft BASIC Compiler 6.0b
  • Microsoft QuickBASIC 4.0b, when used with:
    • Microsoft BASIC Compiler 6.0
    • Microsoft BASIC Compiler 6.0b
  • Microsoft QuickBasic 4.5 for MS-DOS, when used with:
    • Microsoft BASIC Compiler 6.0
    • Microsoft BASIC Compiler 6.0b
  • Microsoft QuickBasic Professional Development System 7.0, when used with:
    • Microsoft MS-DOS 6.22 Standard Edition



This article was previously published under Q37346

SUMMARY

If you want to RUN a QuickBasic program, such as PROG.BAS, from within the environment, you must type RUN "PROG" instead of RUN "PROG.EXE". RUN "PROG" successfully loads and executes the source file PROG.BAS. RUN "PROG.EXE" will fail in the editor (as designed) but will succeed in an .EXE running outside the editor.

You cannot use the RUN statement to invoke a non-QuickBasic application from within the QB.EXE editor environment; however, you can use the RUN statement from a compiled .EXE program running outside the editor.

To invoke a non-QuickBasic application from within the QB.EXE editor, you can SHELL to it or exit QuickBasic before invoking it.

QB.EXE Version 4.50 fails to give you an immediate error message if you RUN an executable file from inside the editing environment. QB.EXE Version 4.50 attempts to load and execute the .EXE or .COM program as a text module, which will fail. QBX.EXE which comes with Microsoft Basic PDS Version 7.00 behaves the same as QB.EXE 4.50. It loads the .EXE or .COM file and attempts to execute it as Basic source code. This is not considered to be a problem with those products but is a result of incorrect use of the RUN statement in the environment.

MORE INFORMATION

To illustrate the problem, execute (SHIFT+F5) the following program in the QB.EXE editor:

   RUN "WORD.COM"  'Any executable .EXE or .COM file will demonstrate
                

QB.EXE Version 4.50 attempts to load in WORD.COM as a document; this produces garbage characters in the edit window. (WORD.COM is taken from Microsoft Word.) The environment windows are redrawn, and an "Expected: Statement" error box appears. At this point, you can exit QuickBasic, and no harm is done.

If this program is compiled with BC.EXE, the resultant .EXE file successfully transfers control to WORD.COM.

The results of testing with QuickBasic versions earlier than 4.50 are as follows:

  1. QuickBasic Version 4.00b does not produce an error message, but opens a new module ("Untitled"). If compiled with BC.EXE Version 4.00b, the .EXE file runs as expected.
  2. QuickBasic Version 4.00 produces a "Bad File Mode" on the RUN "WORD.COM" statement when run inside the environment, but executes properly when compiled to an .EXE file.
  3. In QuickBasic Versions 2.00, 2.01, and 3.00, the QB.EXE editor successfully executes RUN "WORD.COM" and removes QuickBasic from memory.



Additional query words: QuickBas BasicCom

Keywords: KB37346