detectgraph

detectgraph

函式名: detectgraph
功 能: 通過檢測硬體確定圖形驅動程式和模式
用 法: void far detectgraph(int far *graphdriver, int far *graphmode);
程式例:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
/* names of the various cards supported */
char *dname[] = { "requests detection",
"a CGA",
"an MCGA",
"an EGA",
"a 64K EGA",
"a monochrome EGA",
"an IBM 8514",
"a Hercules monochrome",
"an AT&T 6300 PC",
"a VGA",
"an IBM 3270 PC"
};
int main(void)
{
/* returns detected hardware info. */
int gdriver, gmode, errorcode;
/* detect graphics hardware available */
detectgraph(&gdriver, &gmode);
/* read result of detectgraph call */
errorcode = graphresult();
if (errorcode != grOk) /* an error
occurred */
{
printf("Graphics error: %s\n", \
grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error
code */
}
/* display the information detected */
clrscr();
printf("You have %s video display \
card.\n", dname[gdriver]);
printf("Press any key to halt:");
getch();
return 0;
}

相關詞條

熱門詞條

聯絡我們