Implementing Scrollbars: Step 4

In the MainWndProc function, add some new local variables to support scrolling. You can add the following code to the existing variable declarations at the beginning of the function:

   int nScrollInc; /* Scrolling increment */
   static BOOL fSizeInUse = FALSE; /* Flag to avoid processing multiple WM_SIZE messages */
   int ClientWidth, ClientHeight, BottomBarThickness, RightBarThickness; /* Client area metrics */
   RECT ScrollRect; /* Used in WM_HSCROLL and WM_VSCROLL to make scrolling smoother */