home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / mag&info / msjv7_6.zip / TOPTEN.ARJ / ETO.ARJ / ETO.VGA < prev    next >
Text File  |  1992-10-01  |  17KB  |  298 lines

  1. Microsoft PLIST Version 1.20
  2.  
  3. Profile: Line timing, sorted by line.
  4. Date:    Sun Jun 07 11:53:20 1992
  5.  
  6.  
  7. Program Statistics
  8. ------------------
  9.     Total time: 13754.184 milliseconds
  10.     Time before any line: 10.978 milliseconds
  11.     Total lines: 102
  12.     Total hits: 11850
  13.     Line coverage:  97.1%
  14.  
  15. Module Statistics for f:\exttext\eto.exe
  16. ----------------------------------------
  17.     Time in module: 13743.206 milliseconds
  18.     Percent of time in module: 100.0%
  19.     Lines in module: 102
  20.     Hits in module: 11850
  21.     Module line coverage:  97.1%
  22.  
  23. Source file: f:\exttext\eto.c
  24.  
  25.                Line        Hit  
  26.   Line         Time   %   count Source
  27. --------------------------------------
  28.     1:                          #include <windows.h>
  29.     2:                          
  30.     3:                          #include "basedefs.h"
  31.     4:                          #include "eto.h"
  32.     5:                          
  33.     6:                          WINPROC WndProc     ( WINDOWS_PARAMS );
  34.     7:                          
  35.     8:                          void TestIDM_RECT_FILLRECT ( HWND hWnd );
  36.     9:                          void TestIDM_RECT_ETO      ( HWND hWnd );
  37.    10:                          void TestIDM_TEXT_TEXTOUT  ( HWND hWnd );
  38.    11:                          void TestIDM_TEXT_ETO      ( HWND hWnd );
  39.    12:                          
  40.    13:                          /**************************************************************
  41.    14:                          *                                                             *
  42.    15:                          *                   Global Variables                          *
  43.    16:                          *                                                             *
  44.    17:                          **************************************************************/
  45.    18:                          
  46.    19:                          HANDLE   ghInst;
  47.    20:                          HWND     ghWnd;
  48.    21:                          char     szNullString[] = "";
  49.    22:                          char     szAppName[] = "ETO";
  50.    23:                          HBRUSH   hRGBBrush[16];
  51.    24:                          COLORREF dwRGB[16];
  52.    25:                          
  53.    26:                          /**************************************************************
  54.    27:                          *                                                             *
  55.    28:                          *                      WinMain                                *
  56.    29:                          *                                                             *
  57.    30:                          **************************************************************/
  58.    31:                          
  59.    32:                          int PASCAL WinMain (HANDLE hInstance,  HANDLE hPrevInstance, 
  60.    33:                                              LPSTR lpszCmdLine, int    nCmdShow       )
  61.    34:        0.008   0.0     1 {
  62.    35:                            MSG         msg       ;
  63.    36:                            WNDCLASS    wndclass  ;
  64.    37:                            int         i;
  65.    38:                          
  66.    39:        0.003   0.0     1   if (!hPrevInstance) 
  67.    40:                              {
  68.    41:                              // Register the Parent Window
  69.    42:                          
  70.    43:        0.003   0.0     1     wndclass.style         = CS_BYTEALIGNCLIENT;
  71.    44:        0.003   0.0     1     wndclass.lpfnWndProc   = (WNDPROC)WndProc ;
  72.    45:        0.005   0.0     1     wndclass.cbClsExtra    = 0 ;
  73.    46:        0.003   0.0     1     wndclass.cbWndExtra    = 0 ;
  74.    47:        0.005   0.0     1     wndclass.hInstance     = hInstance ;
  75.    48:        0.003   0.0     1     wndclass.hIcon         = NULL;
  76.    49:        0.151   0.0     1     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
  77.    50:        0.013   0.0     1     wndclass.hbrBackground = GetStockObject ( LTGRAY_BRUSH ) ;
  78.    51:        0.002   0.0     1     wndclass.lpszMenuName  = (LPSTR)"PlainMenu" ;
  79.    52:        0.003   0.0     1     wndclass.lpszClassName = szAppName ;
  80.    53:                          
  81.    54:        0.350   0.0     1     if (!RegisterClass (&wndclass))
  82.    55:        0.000   0.0     0          return FALSE;
  83.    56:                          
  84.    57:                              }
  85.    58:                          
  86.    59:                            // Generate sixteen cached brushes, for each of the solid colors,
  87.    60:                            // and fill in the dwRGB array
  88.    61:                          
  89.    62:        0.007   0.0     1   for ( i = 0; i < 16; i++ )
  90.    63:                              hRGBBrush[i] = CreateSolidBrush ( dwRGB[i] =
  91.    64:                                                                 RGB
  92.    65:                                                                     ( 
  93.    66:                                                                       min ((((i%8)&4)/4)*(((i%16)/8)+1)*128, 255),
  94.    67:                                                                       min ((((i%8)&2)/2)*(((i%16)/8)+1)*128, 255),
  95.    68:                                                                       min ((((i%8)&1)/1)*(((i%16)/8)+1)*128, 255)
  96.    69:                                                                     )
  97.    70:        1.856   0.0    16                                      );
  98.    71:                          
  99.    72:        0.003   0.0     1   ghInst   = hInstance;
  100.    73:                          
  101.    74:                          
  102.    75:                            ghWnd =        CreateWindow (szAppName, "Tiny Windows App",
  103.    76:                                                         WS_OVERLAPPEDWINDOW,
  104.    77:                                                         CW_USEDEFAULT, 0,
  105.    78:                                                         CW_USEDEFAULT, 0,
  106.    79:        3.771   0.0     1                                NULL, NULL, hInstance, NULL) ;
  107.    80:                          
  108.    81:                          
  109.    82:        0.056   0.0     1   ShowWindow ( ghWnd, nCmdShow );
  110.    83:        0.056   0.0     1   UpdateWindow ( ghWnd );
  111.    84:                          
  112.    85:     4485.348  32.6    78   while (GetMessage((LPMSG)&msg, NULL, 0, 0))
  113.    86:                              {
  114.    87:       10.675   0.1    77     TranslateMessage(&msg);
  115.    88:       14.888   0.1    77     DispatchMessage(&msg);
  116.    89:        6.302   0.0    77     }
  117.    90:                          
  118.    91:        0.081   0.0     1   for ( i = 0; i < 16; i++ )
  119.    92:        3.747   0.0    16     DeleteObject ( hRGBBrush[i] );
  120.    93:                           
  121.    94:        0.080   0.0     1   return msg.wParam ;
  122.    95:        0.107   0.0     1 }
  123.    96:                          
  124.    97:                          /*********************************************************************
  125.    98:                          *                                                                    *
  126.    99:                          *                       WndProc: Main Message Translator             *
  127.   100:                          *                                                                    *
  128.   101:                          *********************************************************************/
  129.   102:                          
  130.   103:                          WINPROC WndProc ( WINDOWS_PARAMS )
  131.   104:       28.903   0.2   337 {
  132.   105:       27.827   0.2   337   switch ( msg )
  133.   106:                              {
  134.   107:                              case WM_COMMAND :
  135.   108:                          
  136.   109:        0.338   0.0     4       switch ( wParam )
  137.   110:                                  {
  138.   111:        0.084   0.0     1         case IDM_RECT_FILLRECT: TestIDM_RECT_FILLRECT ( hWnd ); break;
  139.   112:        0.082   0.0     1         case IDM_RECT_ETO     : TestIDM_RECT_ETO      ( hWnd ); break;
  140.   113:        0.083   0.0     1         case IDM_TEXT_TEXTOUT : TestIDM_TEXT_TEXTOUT  ( hWnd ); break;
  141.   114:        0.083   0.0     1         case IDM_TEXT_ETO     : TestIDM_TEXT_ETO      ( hWnd ); break;
  142.   115:        0.000   0.0     0         }
  143.   116:        0.330   0.0     4       break;
  144.   117:                          
  145.   118:                              case WM_CREATE  :
  146.   119:                          
  147.   120:        0.004   0.0     1       break;
  148.   121:                          
  149.   122:                              case WM_DESTROY :
  150.   123:                          
  151.   124:        0.099   0.0     1       PostQuitMessage (0) ;
  152.   125:        0.081   0.0     1       break ;
  153.   126:                          
  154.   127:                              default :
  155.   128:                          
  156.   129:      116.185   0.8   331       return DefWindowProc ( hWnd, msg, wParam, lParam );
  157.   130:                          
  158.   131:        0.000   0.0     0     }
  159.   132:        0.837   0.0     6   return 0L ;
  160.   133:     2762.242  20.1   337 }
  161.   134:                          //*************************************************************************
  162.   135:                          //
  163.   136:                          //
  164.   137:                          //
  165.   138:                          //*************************************************************************
  166.   139:                          
  167.   140:                          void TestIDM_RECT_FILLRECT ( HWND hWnd )
  168.   141:        0.082   0.0     1 {
  169.   142:                            RECT r;
  170.   143:                            int  i, j;
  171.   144:                            HDC  hDC;
  172.   145:                          
  173.   146:        0.096   0.0     1   GetClientRect ( hWnd, &r );
  174.   147:                          
  175.   148:        0.541   0.0     1   hDC = GetDC ( hWnd );
  176.   149:                          
  177.   150:        0.084   0.0     1   for ( j = 0; j < 3; j++ )
  178.   151:        0.251   0.0     3     for ( i = 0; i < 16; i++ )
  179.   152:      923.935   6.7    48       FillRect ( hDC, &r, hRGBBrush[i] );
  180.   153:                          
  181.   154:        0.322   0.0     1   ReleaseDC ( hWnd, hDC );
  182.   155:                            
  183.   156:        0.084   0.0     1 }
  184.   157:                          
  185.   158:                          //*************************************************************************
  186.   159:                          //
  187.   160:                          //
  188.   161:                          //
  189.   162:                          //*************************************************************************
  190.   163:                          
  191.   164:                          void TestIDM_RECT_ETO      ( HWND hWnd )
  192.   165:        0.082   0.0     1 {
  193.   166:                            RECT r;
  194.   167:                            int  i, j;
  195.   168:                            HDC  hDC;
  196.   169:                          
  197.   170:        0.093   0.0     1   GetClientRect ( hWnd, &r );
  198.   171:                          
  199.   172:        0.545   0.0     1   hDC = GetDC ( hWnd );
  200.   173:                          
  201.   174:        0.085   0.0     1   for ( j = 0; j < 3; j++ )
  202.   175:        0.251   0.0     3     for ( i = 0; i < 16; i++ )
  203.   176:                                {
  204.   177:        8.316   0.1    48       SetBkColor ( hDC, dwRGB[i] );
  205.   178:      952.456   6.9    48       ExtTextOut ( hDC, 0, 0, ETO_OPAQUE, &r, NULL, NULL, NULL );
  206.   179:        4.004   0.0    48       }
  207.   180:                          
  208.   181:        0.318   0.0     1   ReleaseDC ( hWnd, hDC );
  209.   182:        0.086   0.0     1 }
  210.   183:                          
  211.   184:                          //*************************************************************************
  212.   185:                          //
  213.   186:                          //
  214.   187:                          //
  215.   188:                          //*************************************************************************
  216.   189:                          
  217.   190:                          void TestIDM_TEXT_TEXTOUT  ( HWND hWnd )
  218.   191:        0.082   0.0     1 {
  219.   192:                            RECT r;
  220.   193:                            int  i, j, k;
  221.   194:                            HDC  hDC;
  222.   195:                            int  iNumLines;
  223.   196:                            WORD wCharHeight;
  224.   197:        0.096   0.0     1   char szTest[] = "This is a test!!!! ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  225.   198:        0.105   0.0     1   int  cbTest = lstrlen ( szTest );
  226.   199:                          
  227.   200:        0.095   0.0     1   GetClientRect ( hWnd, &r );
  228.   201:                          
  229.   202:        0.551   0.0     1   hDC = GetDC ( hWnd );
  230.   203:                          
  231.   204:        0.207   0.0     1   wCharHeight = HIWORD (GetTextExtent(hDC, szTest, cbTest));
  232.   205:                          
  233.   206:        0.183   0.0     1   r.left = LOWORD (GetTextExtent(hDC, szTest, cbTest));
  234.   207:                          
  235.   208:        0.082   0.0     1   iNumLines = r.bottom / wCharHeight;
  236.   209:                          
  237.   210:        0.085   0.0     1   for ( j = 0; j < 3; j++ )
  238.   211:        0.252   0.0     3     for ( i = 0; i < 16; i++ )
  239.   212:                                {
  240.   213:        6.341   0.0    48       SetBkColor   ( hDC, dwRGB[i]    );
  241.   214:        6.059   0.0    48       SetTextColor ( hDC, dwRGB[15-i] );
  242.   215:                          
  243.   216:        4.061   0.0    48       for ( k = 0; k < iNumLines; k++ )
  244.   217:                                  {
  245.   218:       96.338   0.7  1056         r.top    = k*wCharHeight;
  246.   219:       91.389   0.7  1056         r.bottom = r.top + wCharHeight;
  247.   220:     1312.952   9.6  1056         TextOut ( hDC, 0, k*wCharHeight, szTest, cbTest ); 
  248.   221:      702.363   5.1  1056         FillRect ( hDC, &r, hRGBBrush[i] );
  249.   222:       92.060   0.7  1056         }
  250.   223:                                
  251.   224:        4.410   0.0    48       }
  252.   225:                          
  253.   226:        0.322   0.0     1   ReleaseDC ( hWnd, hDC );
  254.   227:        0.087   0.0     1 }
  255.   228:                          
  256.   229:                          //*************************************************************************
  257.   230:                          //
  258.   231:                          //
  259.   232:                          //
  260.   233:                          //*************************************************************************
  261.   234:                          
  262.   235:                          void TestIDM_TEXT_ETO      ( HWND hWnd )
  263.   236:        0.081   0.0     1 {
  264.   237:                            RECT r;
  265.   238:                            int  i, j, k;
  266.   239:                            HDC  hDC;
  267.   240:                            int  iNumLines;
  268.   241:                            WORD wCharHeight;
  269.   242:        0.097   0.0     1   char szTest[] = "This is a test!!!! ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  270.   243:        0.104   0.0     1   int  cbTest = lstrlen ( szTest );
  271.   244:                          
  272.   245:        0.096   0.0     1   GetClientRect ( hWnd, &r );
  273.   246:                          
  274.   247:        0.554   0.0     1   hDC = GetDC ( hWnd );
  275.   248:                          
  276.   249:        0.209   0.0     1   wCharHeight = HIWORD (GetTextExtent(hDC, szTest, cbTest));
  277.   250:                          
  278.   251:        0.084   0.0     1   iNumLines = r.bottom / wCharHeight;
  279.   252:                          
  280.   253:        0.082   0.0     1   for ( j = 0; j < 3; j++ )
  281.   254:        0.246   0.0     3     for ( i = 0; i < 16; i++ )
  282.   255:                                {
  283.   256:        6.481   0.0    48       SetBkColor   ( hDC, dwRGB[i]    );
  284.   257:        6.087   0.0    48       SetTextColor ( hDC, dwRGB[15-i] );
  285.   258:                          
  286.   259:        4.074   0.0    48       for ( k = 0; k < iNumLines; k++ )
  287.   260:                                  {
  288.   261:       94.930   0.7  1056         r.top    = k*wCharHeight;
  289.   262:       91.861   0.7  1056         r.bottom = r.top + wCharHeight;
  290.   263:     1755.664  12.8  1056         ExtTextOut ( hDC, 0, k*wCharHeight, ETO_OPAQUE, &r, szTest, cbTest, NULL ); 
  291.   264:      103.702   0.8  1056         }
  292.   265:                                
  293.   266:        3.983   0.0    48       }
  294.   267:                          
  295.   268:        0.324   0.0     1   ReleaseDC ( hWnd, hDC );
  296.   269:        0.087   0.0     1 }
  297.   270:                          
  298.