| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Code FAQ [8 /15 |
'>>> Page 8 of Code 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.
[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:
OUT &H64, &HFE
Warm boot:
'>>> Page 8 of Code FAQ ends here. Continued in next message.
* Brought to you by Greg's Little QBasic Auto-Poster *
--- Maximus 3.01
* Origin: The BandMaster, Vancouver, B.C., Canada (1:153/7715)SEEN-BY: 633/267 270 @PATH: 153/7715 140/1 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.