How to Use CALL INTERRUPT to Detect If SHARE.EXE Is Loaded

ID: Q67379


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
  • Microsoft QuickBASIC for MS-DOS, versions 4.0, 4.0b, 4.5
  • Microsoft BASIC Compiler for MS-DOS, versions 6.0, 6.0b
  • Microsoft BASIC Professional Development System (PDS) for MS-DOS, versions 7.0, 7.1


SUMMARY

SHARE.EXE provides file sharing and locking to MS-DOS versions 3.0 and later. To determine whether SHARE.EXE is currently loaded, you can make a call to the MS-DOS interrupt, &H2F (2F hex). You should load the AX register with &H1000 before using the CALL INTERRUPT statement. After the call, the AX register will return with the value &H00FF (ff hex) if SHARE.EXE is loaded.


MORE INFORMATION

The following program demonstrates how to call interrupt &H2F to detect if SHARE.EXE is loaded. It makes the interrupt call and then PRINTs what the three separate types of returns can mean.

Code Example

To try this example in VBDOS.EXE:
  1. From the File menu, choose New Project.


  2. Copy the code example to the Code window.


  3. Press F5 to run the program.


To run this program in the VBDOS.EXE environment, you must invoke the VBDOS.EXE environment with the /L switch to load the default Quick library:
VBDOS.EXE /L
To use this program in the QB.EXE or QBX.EXE environment, use the /L environment switch to load the default Quick library, QB.QLB (or QBX.QLB for Basic PDS for MS-DOS 7.0 or 7.1). To make an executable program from this code, you must link with the library, QB.LIB (or Q BX.LIB for Basic PDS for MS-DOS 7.0 or 7.1).

' Use the following include file for Visual Basic for MS-DOS:
REM $INCLUDE: 'VBDOS.BI'
' Use the following include file for QuickBasic for MS-DOS:
REM $INCLUDE: 'QB.BI'
' Use the following include file for Basic PDS for MS-DOS:
REM $INCLUDE: 'QBX.BI'

DIM inregs as regtype
DIM outregs as regtype
inregs.ax = &H1000
CALL interrupt(&H2F,inregs,outregs)

' CHECK results.
IF outregs.ax = &HFF THEN
   PRINT "SHARE.EXE installed"
ELSEIF outregs.ax = &H1 THEN
   PRINT "SHARE.EXE not installed, NOT O.K. to install"
ELSE  ' outregs.ax = &H0
   PRINT "SHARE.EXE not installed, O.K. to install"
ENDIF
END 

Additional query words: VBmsdos QuickBas BasicCom 1.00 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10 3.00

Keywords :
Version : MS-DOS:1.0,4.0,4.0b,4.5; :6.0,6.0b,7.0,7.1
Platform : MS-DOS
Issue type :


Last Reviewed: December 8, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.