home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / video / c / c_2.c < prev   
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1.1 KB  |  76 lines

  1. /* Listing C-2 */
  2.  
  3. main()
  4. {
  5.     char    *SubsystemName();
  6.     char    *DisplayName();
  7.  
  8.     static struct
  9.     {
  10.       char    Subsystem;
  11.       char    Display;
  12.     }
  13.             VIDstruct[2];
  14.  
  15.  
  16.     /* detect video subsystems */
  17.  
  18.     VideoID( VIDstruct );
  19.  
  20.  
  21.     /* show results */
  22.  
  23.     printf( "Video subsystems in this computer:" );
  24.  
  25.     printf( "\n  %s (%s)", SubsystemName(VIDstruct[0].Subsystem),
  26.       DisplayName(VIDstruct[0].Display) );
  27.  
  28.     if ( VIDstruct[1].Subsystem )
  29.       printf( "\n  %s (%s)", SubsystemName(VIDstruct[1].Subsystem),
  30.         DisplayName(VIDstruct[1].Display) );
  31. }
  32.  
  33.  
  34. char *SubsystemName( a )
  35. char    a;
  36. {
  37.     static char *IBMname[] =
  38.     {
  39.       "(none)",
  40.       "MDA",
  41.       "CGA",
  42.       "EGA",
  43.       "MCGA",
  44.       "VGA"
  45.     };
  46.  
  47.     static char *Hercname[] =
  48.     {
  49.       "HGC",
  50.       "HGC+",
  51.       "InColor"
  52.     };
  53.  
  54.     if ( a & 0x80 )
  55.       return ( Hercname[a & 0x7F] );
  56.     else
  57.       return( IBMname[a] );
  58. }
  59.  
  60.  
  61. char *DisplayName( d )
  62. char    d;
  63. {
  64.     static char *name[] =
  65.     {
  66.       "(none)",
  67.       "MDA-compatible monochrome display",
  68.       "CGA-compatible color display",
  69.       "EGA-compatible color display",
  70.       "PS/2-compatible monochrome display",
  71.       "PS/2-compatible color display"
  72.     };
  73.  
  74.     return( name[d] );
  75. }
  76.