home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 / Programming Windows 95.iso / code / CHAP19 / EDRLIB.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-01  |  789 b   |  28 lines

  1. /*-------------------------------------------------
  2.    EDRLIB.C -- Easy Drawing Routine Library module
  3.                (c) Charles Petzold,  1996
  4.   -------------------------------------------------*/
  5.  
  6. #include <windows.h>
  7. #include <string.h>
  8. #include "edrlib.h"
  9.  
  10. int WINAPI DllMain (HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
  11.      {
  12.      return TRUE ;
  13.      }
  14.  
  15. EXPORT BOOL CALLBACK EdrCenterText (HDC hdc, PRECT prc, PSTR pString)
  16.      {
  17.      int  iLength ;
  18.      SIZE size ;
  19.  
  20.      iLength = strlen (pString) ;
  21.  
  22.      GetTextExtentPoint32 (hdc, pString, iLength, &size) ;
  23.  
  24.      return TextOut (hdc, (prc->right - prc->left - size.cx) / 2,
  25.                           (prc->bottom - prc->top - size.cy) / 2,
  26.                      pString, iLength) ;
  27.      }
  28.