home *** CD-ROM | disk | FTP | other *** search
/ Netscape Plug-Ins Developer's Kit / Netscape_Plug-Ins_Developers_Kit.iso / source / Chap07 / msg1.cpp < prev   
Encoding:
Text File  |  1996-10-07  |  753 b   |  35 lines

  1. LONG theResult = -1;
  2. switch(Message)
  3. {
  4.   case WM_PALLETTECHANGED:
  5.   {
  6.     InvalidateRect(hWnd, NULL, TRUE);
  7.     UpdateWindow(hWnd);
  8.     theResult = 0L;
  9.     break;
  10.   }
  11.   case WM_PAINT:
  12.   {
  13.     HBRUSH hBrush;
  14.     HBRUSH hBrushOld;
  15.     PAINTSTRUCT paint;
  16.     HDC hDC = BeginPaint(hWnd, &paint);
  17.     hBrush = CreateSolidBrush(BACKGROUND_COLOR);
  18.     hBrushOld = (HPEN) SelectObject(hDC, hBrush);
  19.     BOOL result = FillRect(hDC, &paint.rcPaint, hBrush);
  20.     SelectObject(hDC, hBrushOld);
  21.     DeleteObject(hBrush);
  22.     EndPaint(hWnd, &paint);
  23.     theResult = 0L;
  24.     break;
  25.   }
  26.   default:
  27.   {
  28.     // this message was not for us; call old Window process
  29.     // this code omitted for clarity
  30.     break;
  31.   }
  32. }
  33. return theResult;
  34.  
  35.