Low-Level DigitalPaint: Processing the Window Activation Messages
This tutorial is giving an example on how to process the window activation messages:
Start with the project you created in Low-Level DigitalPaint: Drawing Text.
| 1. | Add the following function before the OnOpen function definition: | 
static L_VOID OnActivate 
( 
   HWND hWnd, 
   pPAINTHANDLE pPaint,
   pBITMAPHANDLE pBitmap,
   HPALETTE hPalette,
   L_INT nZoom, 
   L_INT nHScroll,
   L_INT nVScroll 
)
{
    PAINTXFORM XForm ;
    HDC hdcCompatibility ; 
    RECT rcDCRect ;
   //set the painting toolkit data
   hdcCompatibility = GetDC ( hWnd ) ; 
   L_PntSetMetrics ( pPaint, hdcCompatibility, pBitmap, hPalette ) ;
   ReleaseDC ( hWnd, hdcCompatibility ) ;
   XForm.nZoom    = nZoom ;
   XForm.nXOffset = nHScroll ;
   XForm.nYOffset = nVScroll ;
   L_PntSetTransformation ( pPaint, &XForm ) ;
   GetClientRect ( hWnd, &rcDCRect ) ;
   L_PntSetDCExtents ( pPaint, &rcDCRect ) ;
}
| 2. | Add the following line after the "break;" statement of the "case WM_PAINT:" statement: | 
case WM_ACTIVATE:
         if ( WA_INACTIVE != LOWORD ( wParam ) )
         {
            OnActivate ( hWnd, pPaint, &hBitmap, hPalette, nZoomFactor, nHScroll, nVScroll ) ;
            return 0 ;
         }
         break ;
| 3. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu. |