home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / video / 13 / 13_8.c < prev   
Encoding:
Text File  |  1988-08-11  |  990 b   |  47 lines

  1. /* Listing 13-8 */
  2.  
  3.  
  4.     HWND hWnd;                      /* window handle */
  5.     HDC  hDC;                       /* device context handle */
  6.  
  7.     struct
  8.     {
  9.       HDC hdc;                      /* device context handle */
  10.       BOOL fErase;
  11.       RECT rcPaint;
  12.       BOOL fRestore;
  13.       BOOL fIncUpdate;
  14.       BYTE rgbReserved[16];
  15.     }                         ps;   /* "paint structure" */
  16.  
  17.  
  18.     /* create a window */
  19.  
  20.     hWnd = CreateWindow( ... );
  21.     .
  22.     .
  23.     .
  24.  
  25.     /* initialize device context for window */
  26.  
  27.     BeginPaint( hWnd, &ps );
  28.     hDC = ps.hdc;
  29.     .
  30.     .
  31.     .
  32.  
  33.     /* associate attributes with device context */
  34.  
  35.     hpen = CreatePen( PS_SOLID, 0, GetSysColor(COLOR_WINDOWTEXT) );
  36.     SelectObject( hDC, (HANDLE)hpen );
  37.  
  38.     hbr = CreateSolidBrush( GetNearestColor(hDC,RectFillColor) );
  39.     SelectObject( hDC, (HANDLE)hbr );
  40.     .
  41.     .
  42.     .
  43.  
  44.     /* draw a filled rectangle */
  45.  
  46.     Rectangle( hDC, 0, 0, 100, 100 );
  47.