Microsoft KB Archive/67379

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

Article ID: 67379

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Visual Basic for MS-DOS
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q67379



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 &quot;SHARE.EXE installed&quot; ELSEIF outregs.ax = &H1 THEN PRINT &quot;SHARE.EXE not installed, NOT O.K. to install&quot; ELSE ' outregs.ax = &H0 PRINT &quot;SHARE.EXE not installed, O.K. to install&quot; 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: KB67379

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.