home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 7.ddi / MWHC.007 / W5 < prev    next >
Encoding:
Text File  |  1991-10-29  |  1.2 KB  |  46 lines

  1. /*---------------------------------------
  2.    PRINT1.C -- Bare Bones Printing
  3.                (c) Charles Petzold, 1990
  4.   ---------------------------------------*/
  5.  
  6. #include <windows.h>
  7.  
  8. HDC  GetPrinterDC (void) ;              // in PRINT.C
  9. void PageGDICalls (HDC, short, short) ;
  10.  
  11. HANDLE hInst ;
  12. char   szAppName [] = "Print1" ;
  13. char   szCaption [] = "Print Program 1" ;
  14.  
  15. char szText[100];
  16.  
  17. BOOL PrintMyPage (HWND hwnd)
  18.      {
  19.      static char szMessage [] = "Print1: Printing" ;
  20.      BOOL        bError = FALSE ;
  21.      HDC         hdcPrn ;
  22.      short       xPage, yPage ;
  23.  
  24.      if (NULL == (hdcPrn = GetPrinterDC ()))
  25.           return TRUE ;
  26.  
  27.      xPage = GetDeviceCaps (hdcPrn, HORZRES) ;
  28.      yPage = GetDeviceCaps (hdcPrn, VERTRES) ;
  29.  
  30.      if (Escape (hdcPrn, STARTDOC, sizeof szMessage - 1, szMessage, NULL) > 0)
  31.           {
  32.           PageGDICalls (hdcPrn, xPage, yPage) ;
  33.  
  34.           if (Escape (hdcPrn, NEWFRAME, 0, NULL, NULL) > 0) {
  35.                Escape (hdcPrn, ENDDOC, 0, NULL, NULL) ;
  36.            }
  37.           else
  38.                bError = TRUE;
  39.           }
  40.      else
  41.           bError = TRUE;
  42.  
  43.      DeleteDC (hdcPrn) ;
  44.      return bError ;
  45.      }
  46.