BBS: Inland Empire Archive Date: 01-28-93 (11:29) Number: 385 From: CORIDON HENSHAW Refer#: NONE To: JEFF JOHNSTON Recvd: NO Subj: Detecting video... Conf: (2) Quik_Bas
Hello Jeff!
In a msg of <25 Jan 93>, Jeff Johnston writes to All:
JJ> Is there a way to automatically detect which video adapter is being
JJ> used?
Yup. The below FUNCTION will do the trick.
===Chop===
'$INCLUDE: 'QBX.BI'
'Change to QB.BI if using QuickBASIC.
DECLARE FUNCTION GetVideoCard$ ()
DEFINT A-Z
FUNCTION GetVideoCard$
DIM Regs AS RegTypeX
Regs.AX = &H1A00
CALL InterruptX(&H10, Regs, Regs)
IF (Regs.AX AND &HFF) = &H1A THEN
Code = Regs.bx AND &HFF
SELECT CASE Code
CASE 1
GetVideoCard$ = "MDA"
CASE 2
GetVideoCard$ = "CGA"
CASE 4 TO 5
GetVideoCard$ = "EGA"
CASE 6
GetVideoCard$ = "PGA"
CASE 7 TO 8
GetVideoCard$ = "VGA"
END SELECT
EXIT FUNCTION
ELSE
Regs.AX = &H1200
Regs.bx = &H10
CALL InterruptX(&H10, Regs, Regs)
IF (Regs.bx AND &HFF) <> &H10 THEN
GetVideoCard$ = "EGA"
EXIT FUNCTION
ELSE
Regs.AX = &HF00
CALL InterruptX(&H10, Regs, Regs)
IF (Regs.AX AND &HFF) = 7 THEN
GetVideoCard$ = "MDA"
EXIT FUNCTION
ELSE
GetVideoCard$ = "CGA"
EXIT FUNCTION
END IF
END IF
END IF
END FUNCTION
===Chop===
< Coridon Henshaw >
< Sirrus Software >
...Get outta my face, Stenchler!
--- GEcho 1.00
* Origin: Politicly INcorrect and damn proud of it (1:250/820)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET