Setting Container Metrics

Start with the project you created in Implementing the Container - Initializing, Creating and Freeing.

1.

Add the following code to the WndProc function before the function InvalidateRect in the "case IDM_FILE_OPEN:" statement:

{ // CONTAINER METRICS
   CONTAINERMETRICS Metrics ;

   Metrics.nSize = sizeof ( CONTAINERMETRICS ) ;
   Metrics.dwMask   = CMF_LIMITS | CMF_PALETTE ;
   Metrics.hPalette = hPalette ;
   SetRect ( &Metrics.rcLimits, 0, 0, BITMAPWIDTH ( &hBitmap ), BITMAPHEIGHT ( &hBitmap ) ) ;

   L_ContainerSetMetrics ( pContainer, &Metrics ) ;
} // CONTAINER METRICS

2.

Compile and run the project by selecting Build->Rebuild Solution from the menu, and then Debug->Start Without Debugging.