Technical Notes Database
TN781D.txt GRAPH DETECT VIDEO CARD AUTODETECT HARDWARE
Category :Pascal
Platform :All
Product :Turbo Pascal 4.0+
Description:
Q. How can I detect what kind of video card my computer has
using Turbo Pascal?
A. The Graph unit of Turbo Pascal has an autodetection scheme
built-in which will allow you to detect what kind of graphics
hardware is available at runtime. See the following example:
Program AutoDetectGraphics;
Uses Graph;
var
gd,gm: integer;
Procedure InitializeGraphics;
begin
gd:=Detect;
InitGraph(gd,gm,'');
OutTextXY(20,20,'Graphics Test!');
readln;
CloseGraph;
end; { InitializeGraphics }
Procedure DetectGraphics(var driver, mode: integer);
begin
DetectGraph(driver,mode);
end; { DetectGraphics }
begin { MAIN }
DetectGraphics(gd,gm);
writeln('Detected: ');
writeln(' GraphDriver = ',gd);
writeln(' GraphMode = ',gm);
readln;
InitializeGraphics;
end. { End of Program }
Reference:
7/16/98 4:35:35 PM
Last Modified: 01-SEP-99