'>>> Page 7 of CODE0398.FAQ begins here.
SUB MouseCtrl (x)
DIM reg AS RegType
reg.ax = x '0 = initialize/reset mouse
'1 = show cursor
'2 = hide cursor
'3 = get current coordinates
'7 = set horizontal coordinates
'8 = set vertical coordinates
IF x = 7 THEN
reg.cx = HMin: reg.dx = HMax
ELSEIF x = 8 THEN
reg.cx = VMin: reg.dx = VMax
END IF
INTERRUPT &H33, reg, reg
END SUB
[end]
Usage:
MouseCtrl 0 'initialize mouse..must be done first!
MouseCtrl 1 'make mouse visible
Mouse cx, dx, bx 'get mouse status
HMin = 0: HMax = 100: MouseCtrl 7 'set horiz. PIXEL limits
7) HOW CAN I CHECK FOR THE EXISTENCE OF A CERTAIN FILE?
There are many ways to do this; this FAQ will cover two of
them. One method is to use the error-trapping features of
QB (code by David Aukerman):
[begin]
INPUT "Enter the file to open: ", File$
FileThere% = 1 'assume the file is there
ON ERROR GOTO FileNotFound
OPEN File$ FOR INPUT AS #1
ON ERROR GOTO 0
IF FileThere% = 1 THEN 'if we haven't been proven wrong,
PRINT "The file exists."
ELSE
PRINT "The file does not exist."
END IF
END
FileNotFound:
SELECT CASE ERR
CASE 53: FileThere% = 0 'File not found!!
END SELECT
[end]
Another method is to use INTERRUPTs. If you use this one,
be sure to load QB with the /L switch. Code by Joe Negron.
Edited for format.
[begin]
DEFINT A-Z
DECLARE FUNCTION Exist% (FileName$)
'***************************************************************
'* FUNCTION Exist% *
'* *
'* PURPOSE *
'* Uses DOS ISR 21H, Function 4EH (Find First Matching *
'* Directory Entry) to determine the existence of FileName$.*
'***************************************************************
FUNCTION Exist% (FileName$) STATIC
DIM IRegsX AS RegTypeX, ORegsX AS RegTypeX
IRegsX.ax = &H4E00
IRegsX.cx = &H3F 'search for all files
FileName$ = FileName$ + CHR$(0) 'must end with null byte
IRegsX.ds = VARSEG(FileName$) 'load DS:DX with
IRegsX.dx = SADD(FileName$) 'address of FileName$
InterruptX &H21, IRegsX, ORegsX
Exist% = ORegsX.ax = 0 'if ax contains a value,
'remove the null byte
FileName$ = LEFT$(FileName$, LEN(FileName$) - 1)
END FUNCTION
[end]
8) HOW DO I PERFORM A COLD/WARM BOOT THROUGH QB?
Cold boot:
'>>> Page 7 of CODE0398.FAQ ends here. Continued on next page.
___
* SLMR 2.0 * RAM disk is *not* an installation procedure.
--- Maximus/2 3.01
---------------
* Origin: The I.O. Board - 4GB -XX- V34+ (1:2255/10)
|