home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / MSJV5-6.ZIP / FORM2.ZIP / FORM3.C < prev    next >
C/C++ Source or Header  |  1990-11-01  |  23KB  |  758 lines

  1. /*
  2.  * FORM LIBRARY - PRINT FORM MODULE
  3.  *
  4.  * LANGUAGE      : Microsoft C5.1
  5.  * MODEL         : medium
  6.  * ENVIRONMENT   : Microsoft Windows 3.0 SDK
  7.  * STATUS        : operational
  8.  *
  9.  *    Eikon Systems, Inc.
  10.  *    989 East Hillsdale Blvd, Suite 260
  11.  *    Foster City, California 94404
  12.  *    415-349-4664
  13.  *
  14.  * 07/12/90 1.00 - Kevin P. Welch - initial creation.
  15.  *
  16.  */
  17.  
  18. #define  NOCOMM
  19.  
  20. #include <windows.h>
  21.  
  22. #include "form.h"
  23. #include "form.d"
  24.  
  25. /* local macro definitions */
  26. #define  xRCtoDEV(x)          (((x)*TextMetric.tmAveCharWidth)/4)
  27. #define  yRCtoDEV(x)          (((x)*TextMetric.tmHeight)/8)
  28. #define  xDEVtoRC(x)          (((x)*4)/TextMetric.tmAveCharWidth)
  29. #define  yDEVtoRC(x)          (((x)*8)/TextMetric.tmHeight)
  30.  
  31. /* local function definitions */
  32. BOOL FAR PASCAL   PrintInit( HWND, WORD, LONG );
  33. BOOL FAR PASCAL   PrintCommand( HWND, WORD, LONG );
  34. BOOL FAR PASCAL   PrintOutput( HDC, HANDLE, LPSTR, WORD, WORD, WORD );
  35. BOOL FAR PASCAL   PrintDestroy( HWND, WORD, LONG );
  36.  
  37. /* */
  38.  
  39. /*
  40.  * FormPrint( hWndParent, hData ) : HANDLE
  41.  *
  42.  *    hWndParent     handle to parent window
  43.  *    hData          handle to form data block
  44.  *
  45.  * This function displays a dialog box, enabling the user to print
  46.  * the contents of the current form.  If the printing process was
  47.  * successful the handle to the data block provided is returned.  If
  48.  * the printing process was cancelled, a value of NULL is returned.
  49.  *
  50.  */
  51.  
  52. HANDLE FAR PASCAL FormPrint(
  53.    HWND        hWndParent,
  54.    HANDLE      hData )
  55. {
  56.    MSG         Msg;
  57.    HDC         hPrnDC;
  58.    WORD        wLine;
  59.    WORD        wPage;
  60.    WORD        wLinesPerPage;
  61.    WORD        wPixelsPerLine;
  62.    BOOL        bFirstLine;
  63.    HWND        hWndFocus;
  64.    HWND        hDlgPrint;
  65.    HANDLE      hResult;
  66.    HANDLE      hResInfo;
  67.    HANDLE      hResData;
  68.    HANDLE      hDlgData;
  69.    LPDLGBOX    lpDlgData;
  70.    LPSTR       lpszResData;
  71.    TEXTMETRIC  TextMetric;
  72.  
  73.    char        szHeader[MAX_HEADER];
  74.    char        szFooter[MAX_FOOTER];
  75.    
  76.    /* initialization */
  77.    hResult = NULL;
  78.  
  79.    szHeader[0] = NULL;
  80.    szFooter[0] = NULL;
  81.  
  82.    /* find report information */
  83.    hResInfo = FindResource( FormInfo.hInstance, "REPORT", RT_RCDATA );
  84.    if ( hResInfo ) {
  85.  
  86.       /* load resource information */
  87.       hResData = LoadResource( FormInfo.hInstance, hResInfo );
  88.       if ( hResData ) {
  89.  
  90.          /* lock resource data */
  91.          lpszResData = LockResource( hResData );
  92.          if ( lpszResData ) {
  93.          
  94.             /* create printer display context */
  95.             hPrnDC = GetPrinterDC();
  96.             if ( hPrnDC ) {
  97.  
  98.                /* retrieve page & text metrics */
  99.                GetTextMetrics( hPrnDC, &TextMetric );
  100.                
  101.                wPixelsPerLine = TextMetric.tmHeight + TextMetric.tmExternalLeading;
  102.                wLinesPerPage = GetDeviceCaps(hPrnDC,VERTRES) / wPixelsPerLine;
  103.  
  104.                /* allocate dialog template */
  105.                hDlgData = GlobalAlloc( GHND, (DWORD)sizeof(DLGBOX) );
  106.                if ( hDlgData ) {
  107.  
  108.                   /* define the contents */
  109.                   lpDlgData = (LPDLGBOX)GlobalLock( hDlgData );
  110.                   if ( lpDlgData ) {
  111.  
  112.                      lpDlgData->lStyle = WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_POPUP | WS_VISIBLE;
  113.                      lpDlgData->wControls = 0;
  114.                      lpDlgData->wX = 0;
  115.                      lpDlgData->wY = 0;
  116.                      lpDlgData->wCX = (lstrlen(FormInfo.szTitle)*4)+72;
  117.                      lpDlgData->wCY = 46;
  118.  
  119.                      lpDlgData->szMenu[0] = 0;
  120.                      lpDlgData->szClass[1] = 0;
  121.  
  122.                      lstrcpy( &lpDlgData->szCaption[0], "Printing" );
  123.  
  124.                      /* disable parent window */
  125.                      hWndFocus = GetFocus();
  126.                      EnableWindow( hWndParent, FALSE ); 
  127.          
  128.                      /* create dialog box */
  129.                      hDlgPrint = CreateDialogIndirect( FormInfo.hInstance, (LPSTR)lpDlgData, hWndParent, FormPrintDlgFn );
  130.                      if ( hDlgPrint ) {
  131.  
  132.                         /* unlock dialog template */
  133.                         GlobalUnlock( hDlgData );
  134.  
  135.                         /* start printing */
  136.                         if ( Escape(hPrnDC,STARTDOC,lstrlen(FormInfo.szTitle),FormInfo.szTitle,NULL) > 0 ) {
  137.    
  138.                            /* initialization for printing */
  139.                            wLine = 1;
  140.                            wPage = 1;
  141.  
  142.                            bFirstLine = TRUE;
  143.  
  144.                            /* print each line */
  145.                            while ( *lpszResData && IsWindow(hDlgPrint) ) {
  146.                            
  147.                               /* allow other applications some time */
  148.                               if ( PeekMessage(&Msg,NULL,0,0,PM_REMOVE) )
  149.                                  if ( !IsDialogMessage(hDlgPrint,&Msg) ) {
  150.                                     TranslateMessage( &Msg );
  151.                                     DispatchMessage( &Msg );
  152.                                  }
  153.  
  154.                               /* check if not header definition */
  155.                               if ( StringMatch(lpszResData,"%HEADER") == FALSE ) {
  156.  
  157.                                  /* check if not footer definition */
  158.                                  if ( StringMatch(lpszResData,"%FOOTER") == FALSE ) {
  159.                               
  160.                                     /* move to new frame (if necessary) */
  161.                                     if ( ((szFooter[0])&&(wLine+2>=wLinesPerPage))||(wLine>=wLinesPerPage) ) {
  162.  
  163.                                        /* output footer (if necessary) */
  164.                                        if ( szFooter[0] ) {
  165.                                           PrintOutput(
  166.                                              hPrnDC, 
  167.                                              hData,
  168.                                              szFooter, 
  169.                                              wPage, 
  170.                                              wLinesPerPage-1,
  171.                                              wPixelsPerLine
  172.                                           );
  173.                                           wLine += 2;
  174.                                        }
  175.  
  176.                                        /* move to a new page frame */
  177.                                        wPage++;
  178.                                        wLine = 1;
  179.                                  
  180.                                        Escape( hPrnDC, NEWFRAME, 0, NULL, NULL );
  181.  
  182.                                        /* output header (if necessary) */
  183.                                        if ( szHeader[0] ) {
  184.                                           PrintOutput(
  185.                                              hPrnDC, 
  186.                                              hData,
  187.                                              szHeader, 
  188.                                              wPage, 
  189.                                              wLine,
  190.                                              wPixelsPerLine
  191.                                           );
  192.                                           wLine += 2;
  193.                                        }
  194.  
  195.                                     }
  196.                               
  197.                                     /* output header (if necessary) */
  198.                                     if ( bFirstLine && szHeader[0] ) {
  199.                                        bFirstLine = FALSE;
  200.                                        PrintOutput(
  201.                                           hPrnDC, 
  202.                                           hData,
  203.                                           szHeader, 
  204.                                           wPage, 
  205.                                           wLine,
  206.                                           wPixelsPerLine
  207.                                        );
  208.                                        wLine += 2;
  209.                                     }
  210.  
  211.                                     /* output current line */
  212.                                     PrintOutput(
  213.                                        hPrnDC, 
  214.                                        hData,
  215.                                        lpszResData, 
  216.                                        wPage, 
  217.                                        wLine++,
  218.                                        wPixelsPerLine
  219.                                     );
  220.  
  221.                                  } else 
  222.                                     StringCopy( szFooter, lpszResData+7, sizeof(szFooter) );
  223.  
  224.                               } else
  225.                                  StringCopy( szHeader, lpszResData+7, sizeof(szHeader) );
  226.  
  227.                               /* advance to next line in report */
  228.                               while ( *lpszResData ) 
  229.                                  lpszResData++;
  230.  
  231.                               lpszResData += 2;
  232.  
  233.                            }
  234.  
  235.                            /* end printing */
  236.                            if ( IsWindow(hDlgPrint) ) {
  237.  
  238.                               /* define return value */
  239.                               hResult = hData;
  240.  
  241.                               /* output footer (if necessary) */
  242.                               if ( szFooter[0] ) 
  243.                                  PrintOutput(
  244.                                     hPrnDC, 
  245.                                     hData,
  246.                                     szFooter, 
  247.                                     wPage, 
  248.                                     wLinesPerPage-1,
  249.                                     wPixelsPerLine
  250.                                  );
  251.                               
  252.                               /* end printing */
  253.                               Escape( hPrnDC, NEWFRAME, 0, NULL, NULL );
  254.                               Escape( hPrnDC, ENDDOC, 0, NULL, NULL );
  255.  
  256.                            } else 
  257.                               Escape( hPrnDC, ENDDOC, 0, NULL, NULL );
  258.  
  259.                         } else 
  260.                            WARNING( hDlgPrint, "Unable to access printer!" );
  261.  
  262.                         /* destroy print dialog box */
  263.                         if ( IsWindow(hDlgPrint) )
  264.                            DestroyWindow( hDlgPrint );
  265.  
  266.                      } else {
  267.                         GlobalUnlock( hDlgData );
  268.                         WARNING( hWndParent, "Unable to create print dialog box!" );
  269.                      }
  270.  
  271.                      /* enable parent window */
  272.                      EnableWindow( hWndParent, TRUE ); 
  273.                      SetFocus( hWndFocus );
  274.  
  275.                   }
  276.          
  277.                   /* free dialog template */
  278.                   GlobalFree( hDlgData );
  279.  
  280.                }
  281.  
  282.                /* delete printer display context */
  283.                DeleteDC( hPrnDC );
  284.    
  285.             } else
  286.                WARNING( hWndParent, "Unable to access printer!" );
  287.    
  288.          
  289.             /* unlock resource data */
  290.             UnlockResource( hResData );
  291.  
  292.          } else
  293.             WARNING( NULL, "Unable to lock report definition!" );
  294.  
  295.          /* free resource data */
  296.          FreeResource( hResData );
  297.  
  298.       } else
  299.          WARNING( NULL, "Unable to load report definition!" );
  300.  
  301.    } else
  302.       WARNING( NULL, "Unable to find report definition!" );
  303.  
  304.    /* return final result */
  305.    return( hResult );
  306.  
  307. }
  308.  
  309. /* */
  310.  
  311. /*
  312.  * FormPrintDlgFn( hDlg, wMessage, wParam, lParam ) : LONG;
  313.  *
  314.  *    hDlg           dialog box window handle
  315.  *    wMessage       dialog box message
  316.  *    wParam         word parameter
  317.  *    lParam         long parameter
  318.  *
  319.  * This function is responsible for processsing all the messages relating
  320.  * to the print form dialog box.
  321.  *
  322.  */
  323.  
  324. BOOL FAR PASCAL FormPrintDlgFn(
  325.    HWND     hDlg,
  326.    WORD     wMessage,
  327.    WORD     wParam,
  328.    LONG     lParam )
  329. {
  330.    BOOL     bResult;
  331.  
  332.    /* initialization */
  333.    bResult = TRUE;
  334.  
  335.    /* process message */
  336.    switch ( wMessage )
  337.       {
  338.    case WM_INITDIALOG : /* initialize dialog box */
  339.       bResult = PrintInit( hDlg, wParam, lParam );
  340.       break;
  341.    case WM_COMMAND:
  342.       bResult = PrintCommand( hDlg, wParam, lParam );
  343.       break;
  344.    case WM_DESTROY :
  345.       bResult = PrintDestroy( hDlg, wParam, lParam );
  346.       break;
  347.    default : /* some other message */
  348.       bResult = FALSE;
  349.       break;
  350.    }
  351.  
  352.    /* return final result */
  353.    return bResult;
  354.  
  355. }
  356.  
  357. /* */
  358.  
  359. /*
  360.  * PrintInit( hDlg, wParam, lParam ) : BOOL;
  361.  *
  362.  *    hDlg           handle to dialog box
  363.  *    wParam         word parameter
  364.  *    lParam         long parameter
  365.  *
  366.  * The function defines each of the control pages and initializes the
  367.  * print dialog box.  A value of TRUE is returned if the process
  368.  * was successful.
  369.  *
  370.  */
  371.  
  372. BOOL FAR PASCAL PrintInit(
  373.    HWND        hDlg,
  374.    WORD        wParam,
  375.    LONG        lParam )
  376. {
  377.    HDC         hDC;
  378.    WORD        wWidth;
  379.    WORD        wHeight;
  380.    RECT        rcClient;
  381.    TEXTMETRIC  TextMetric;
  382.  
  383.    char        szString[MAX_TITLE];
  384.  
  385.    /* warning level 3 compatibility */
  386.    wParam;
  387.    lParam;
  388.    
  389.    /* define property lists */
  390.    SET_DATA( hDlg, FormInfo.hTempData );
  391.  
  392.    /* calculate text metrics */
  393.    hDC = GetDC( hDlg );
  394.    GetTextMetrics( hDC, &TextMetric );
  395.    ReleaseDC( hDlg, hDC );
  396.  
  397.    /* calculate dialog box dimensions in RC coordinates */
  398.    GetClientRect( hDlg, &rcClient );
  399.    
  400.    wWidth = xDEVtoRC( rcClient.right - rcClient.left );
  401.    wHeight = yDEVtoRC( rcClient.bottom - rcClient.top );
  402.  
  403.    /* create static controls */
  404.    StringCopy( szString, "The ", sizeof(szString) );
  405.    StringCat( szString, FormInfo.szTitle, sizeof(szString) );
  406.    StringCat( szString, " is", sizeof(szString) );
  407.    
  408.    CreateWindow(
  409.       "static",
  410.       szString,
  411.       SS_CENTER | WS_CHILD | WS_VISIBLE,
  412.       xRCtoDEV(4),
  413.       yRCtoDEV(6),
  414.       xRCtoDEV(wWidth-8),
  415.       yRCtoDEV(8),
  416.       hDlg,
  417.       (WORD)-1,
  418.       INSTANCE(PARENT(hDlg)),
  419.       NULL
  420.    );
  421.      
  422.    CreateWindow(
  423.       "static",
  424.       "being sent to the printer.",
  425.       SS_CENTER | WS_CHILD | WS_VISIBLE,
  426.       xRCtoDEV(4),
  427.       yRCtoDEV(14),
  428.       xRCtoDEV(wWidth-8),
  429.       yRCtoDEV(8),
  430.       hDlg,
  431.       (WORD)-1,
  432.       INSTANCE(PARENT(hDlg)),
  433.       NULL
  434.    );
  435.  
  436.    CreateWindow(
  437.       "button",
  438.       "Cancel",
  439.       BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD | WS_VISIBLE,
  440.       xRCtoDEV((wWidth/2)-16),
  441.       yRCtoDEV(28),
  442.       xRCtoDEV(32),
  443.       yRCtoDEV(14),
  444.       hDlg,
  445.       IDCANCEL,
  446.       INSTANCE(PARENT(hDlg)),
  447.       NULL
  448.    );
  449.  
  450.    /* center within parent window */
  451.    CenterPopup( hDlg, GetParent(hDlg) );
  452.  
  453.    /* return result */
  454.    return( TRUE );
  455.  
  456. }
  457.  
  458. /* */
  459.  
  460. /*
  461.  * PrintCommand( hDlg, wParam, lParam ) : BOOL;
  462.  *
  463.  *    hDlg           handle to dialog box
  464.  *    wParam         word parameter
  465.  *    lParam         long parameter
  466.  *
  467.  * The function is responsible for handling the WM_COMMAND messages
  468.  * received by the print dialog box window function.  A value of TRUE
  469.  * is returned if the process was successful.
  470.  *
  471.  */
  472.  
  473. BOOL FAR PASCAL PrintCommand(
  474.    HWND        hDlg,
  475.    WORD        wParam,
  476.    LONG        lParam )
  477. {
  478.  
  479.    /* warning level 3 compatibility */
  480.    wParam;
  481.    lParam;
  482.    
  483.    /* process commands */
  484.    switch( wParam )
  485.       {
  486.    case IDCANCEL : /* cancel form */
  487.       DestroyWindow( hDlg );
  488.       break;
  489.    default : /* something else - ignore */
  490.       break;
  491.    }
  492.  
  493.    /* return result */
  494.    return( TRUE );
  495.  
  496. }
  497.  
  498. /* */
  499.  
  500. /*
  501.  * PrintOutput( hPrnDC, hData, lpszPattern, wPage, wLine, wPixels ) : BOOL;
  502.  *
  503.  *    hPrnDC         printer display context
  504.  *    hData          form data block
  505.  *    lpszPattern    output specification string
  506.  *    wPage          current page number
  507.  *    wLine          current line number
  508.  *    wPixels        number of pixels per output page
  509.  *
  510.  * This function outputs a report line based on the output specification
  511.  * string and data block provided.  Any variable names present in the
  512.  * output specification string are automatically expanded, including
  513.  * those that reference the following predefined variables:
  514.  *
  515.  *    LINE     current line number
  516.  *    PAGE     current page number
  517.  *
  518.  * A value of TRUE is returned if the current string was successfully
  519.  * output to the printer.
  520.  *
  521.  */
  522.  
  523. BOOL FAR PASCAL PrintOutput(
  524.    HDC         hPrnDC,
  525.    HANDLE      hData,
  526.    LPSTR       lpszPattern,
  527.    WORD        wPage,
  528.    WORD        wLine,
  529.    WORD        wPixels )
  530. {
  531.    BOOL        bLeft;
  532.  
  533.    WORD        wWidth;
  534.    WORD        wLength;
  535.    WORD        wPrecision;
  536.  
  537.    LPSTR       lpszName;
  538.    LPSTR       lpszData;
  539.    LPSTR       lpszOutput;
  540.  
  541.    char        szName[MAX_NAME];
  542.    char        szData[MAX_DATA];
  543.    char        szOutput[MAX_DATA];
  544.  
  545.    /* define output string */
  546.    lpszOutput = szOutput;
  547.    
  548.    while ( *lpszPattern ) {
  549.  
  550.       /* check for identifiers */
  551.       if ( (*lpszPattern=='%')&&(*(lpszPattern+1)!='%')&&(*(lpszPattern+1)!=' ') ) {
  552.             
  553.          /* initialization */
  554.          wWidth = 0;
  555.          wPrecision = 0;
  556.  
  557.          bLeft = FALSE;
  558.       
  559.          /* extract identifier */
  560.          lpszPattern++;
  561.          lpszName = szName;
  562.          
  563.          /* extract allignment flag (optional) */
  564.          if ( *lpszPattern == '-' ) {
  565.             lpszPattern++;
  566.             bLeft = TRUE;
  567.          } 
  568.  
  569.          /* extract field formating parameters (optional) */
  570.          if ( (*lpszPattern>='0')&&(*lpszPattern<='9') ) {
  571.  
  572.             /* extract field width */
  573.             while ( (*lpszPattern>='0')&&(*lpszPattern<='9') ) {
  574.                wWidth = (wWidth*10) + *lpszPattern - '0';
  575.                lpszPattern++;
  576.             }
  577.  
  578.             /* extract field width (optional) */
  579.             if ( *lpszPattern == '.' ) {
  580.  
  581.                /* skip period */
  582.                lpszPattern++;
  583.  
  584.                /* extract field width */
  585.                while ( (*lpszPattern>='0')&&(*lpszPattern<='9') ) {
  586.                   wPrecision = (wPrecision*10) + *lpszPattern - '0';
  587.                   lpszPattern++;
  588.                }
  589.  
  590.             }
  591.          
  592.          }
  593.  
  594.          /* extract field name */
  595.          while ( (*lpszPattern)&&(*lpszPattern!=' ') )
  596.             *lpszName++ = *lpszPattern++;
  597.  
  598.          /* append null character */
  599.          *lpszName = 0;
  600.  
  601.          /* define field value */
  602.          if ( StringMatch(szName,"LINENUMBER") == FALSE ) {
  603.             if ( StringMatch(szName,"PAGENUMBER") == FALSE ) {
  604.                if ( GetCtlData(hData,szName,szData,sizeof(szData)) == FALSE ) 
  605.                   StringCopy( szData, "?", sizeof(szData) );
  606.             } else
  607.                wsprintf( szData, "%u", wPage );
  608.          } else
  609.             wsprintf( szData, "%u", wLine );
  610.    
  611.          /* copy field value to output string (if defined) */
  612.          if ( *szData ) {
  613.  
  614.             lpszData = szData;
  615.  
  616.             /* check if field width specified */
  617.             if ( wWidth ) {
  618.  
  619.                /* output data value */
  620.                if ( bLeft ) {
  621.  
  622.                   /* skip leading blanks */
  623.                   while ( (*lpszData)&&(*lpszData==' ') )
  624.                      lpszData++;
  625.  
  626.                   /* check if precision specified */
  627.                   if ( wPrecision ) {
  628.  
  629.                      /* copy value */
  630.                      while ( *lpszData && wPrecision && wWidth ) {
  631.                         wWidth--;
  632.                         wPrecision--;
  633.                         *lpszOutput++ = *lpszData++;
  634.                      }
  635.  
  636.                      /* append blank characters */
  637.                      while ( wWidth ) {
  638.                         *lpszOutput++ = ' ';
  639.                         wWidth--;
  640.                      }
  641.  
  642.                      /* append null */
  643.                      *lpszOutput = NULL;
  644.  
  645.                   } else {
  646.  
  647.                      /* copy value */
  648.                      while ( *lpszData && wWidth ) {
  649.                         wWidth--;
  650.                         *lpszOutput++ = *lpszData++;
  651.                      }
  652.  
  653.                      /* append null */
  654.                      *lpszOutput = NULL;
  655.  
  656.                   }
  657.  
  658.                } else {
  659.  
  660.                   wLength = lstrlen( lpszData );
  661.                   
  662.                   /* strip trailing blanks */
  663.                   while ( (wLength)&&(szData[wLength-1]==' ') ) 
  664.                      szData[--wLength] = NULL;
  665.                   
  666.                   /* prefix blank characters */
  667.                   while ( wLength < wWidth ) {
  668.                      *lpszOutput++ = ' ';
  669.                      wLength++;
  670.                   }
  671.  
  672.                   /* check if precision specified */
  673.                   if ( wPrecision ) {
  674.  
  675.                      /* copy value (checking precision) */
  676.                      while ( *lpszData && wPrecision && wWidth ) {
  677.                         wWidth--;
  678.                         wPrecision--;
  679.                         *lpszOutput++ = *lpszData++;
  680.                      }
  681.  
  682.                      /* append null */
  683.                      *lpszOutput = NULL;
  684.  
  685.                   } else {
  686.  
  687.                      /* copy value */
  688.                      while ( *lpszData && wWidth ) {
  689.                         wWidth--;
  690.                         *lpszOutput++ = *lpszData++;
  691.                      }
  692.  
  693.                      /* append null */
  694.                      *lpszOutput = NULL;
  695.  
  696.                   }
  697.  
  698.                }
  699.             
  700.             } else {
  701.  
  702.                /* copy value without precision or allignment */
  703.                while( *lpszData )
  704.                   *lpszOutput++ = *lpszData++;
  705.                *lpszOutput = 0;
  706.  
  707.             }
  708.  
  709.          }
  710.  
  711.       } else
  712.          *lpszOutput++ = *lpszPattern++;
  713.  
  714.    }
  715.  
  716.    /* append final null */
  717.    *lpszOutput = NULL;
  718.    
  719.    /* output text line */
  720.    TextOut( hPrnDC, 0, wLine*wPixels, szOutput, lstrlen(szOutput) );
  721.  
  722.    /* return result */
  723.    return( TRUE );
  724.  
  725. }
  726.                                                                
  727. /* */
  728.  
  729. /*
  730.  * PrintDestroy( hDlg, wParam, lParam ) : BOOL;
  731.  *
  732.  *    hDlg           handle to dialog box
  733.  *    wParam         word parameter
  734.  *    lParam         long parameter
  735.  *
  736.  * The function is responsible for handling the case when the
  737.  * WM_DESTROY message is received by the print dialog box window
  738.  * function.  A value of TRUE is returned if the cleanup process
  739.  * was successful.
  740.  *
  741.  */
  742.  
  743. BOOL FAR PASCAL PrintDestroy(
  744.    HWND        hDlg,
  745.    WORD        wParam,
  746.    LONG        lParam )
  747. {
  748.  
  749.    /* warning level 3 compatibility */
  750.    hDlg;
  751.    wParam;
  752.    lParam;
  753.    
  754.    /* return result */
  755.    return( TRUE );
  756.  
  757. }
  758.