home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / grafik / video_id / videoidc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-12  |  1.6 KB  |  76 lines

  1. /*
  2. VideoidC - Identifies the graphics card and disply in a PC.
  3. This code is from:
  4.          Programmers Guide to PC & PS/2 Video Systems.
  5.          R. Wilton, Microsoft Press, Redmond, WA.  1987
  6. */
  7.  
  8.  
  9.  
  10. #include <stdio.h>
  11.  
  12. main()
  13. {
  14.        char *SubsystemName();
  15.        char *DisplayName();
  16.  
  17.       static struct
  18.       {
  19.         char Subsystem;
  20.         char Display;
  21.       }
  22.       VIDstruct[2];
  23.  
  24.       VideoID( VIDstruct );
  25.       printf ("Video subsystem in this computer:");
  26.  
  27.       printf ("\n %s (%s) ", SubsystemName(VIDstruct[0].Subsystem),
  28.         DisplayName(VIDstruct[0].Display) );
  29.       if ( VIDstruct[1].Subsystem )
  30.         printf ("\n %s (%s) ",SubsystemName(VIDstruct[1].Subsystem),
  31.            DisplayName(VIDstruct[1].Display) );
  32.  
  33. }
  34.  
  35. char *SubsystemName (a)
  36. char  a;
  37. {
  38.         static char *IBMname[] =
  39.         {
  40.             "(GA_none)",
  41.             "MDA",
  42.             "CGA",
  43.             "EGA",
  44.             "MCGA",
  45.             "VGA"
  46.         };
  47.  
  48.         static char *Hercname[] =
  49.         {
  50.             "HGC",
  51.             "HGC+",
  52.             "InColor"
  53.         };
  54.  
  55.         if (a & 0x80)
  56.             return (Hercname [a & 0x7F]);
  57.         else
  58.             return (IBMname [a]);
  59. }
  60.  
  61.  
  62. char *DisplayName (d)
  63. char  d;
  64. {
  65.         static char *name[] =
  66.         {
  67.             "(Display_none)",
  68.             "MDA-compatible monochrome display",
  69.             "CGA-compatible color display",
  70.             "EGA-compatible color display",
  71.             "PS/2-compatible monochrome display",
  72.             "PS/2-compatible color display"
  73.         };
  74.         return ( name[d] );
  75. }
  76.