|  | 
 
 
 楼主|
发表于 2004-5-8 17:25:31
|
显示全部楼层 
| <  >函数名: 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"
 }; <P>int main(void)
 {
 /* returns detected hardware info. */
 int gdriver, gmode, errorcode; <P>  /* detect graphics hardware available */
 detectgraph(&gdriver, &gmode); <P>   /* 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 */
 } <P>   /* display the information detected */
 clrscr();
 printf("You have %s video display \
 card.\n", dname[gdriver]);
 printf("Press any key to halt:");
 getch();
 return 0;
 }
 </P>
 | 
 |