コード例 #1
0
ファイル: outbask.c プロジェクト: cixonline/ameol
void FASTCALL CmdPrintOutbasket( HWND hwnd )
{
   HPRINT hPr;
   BOOL fOk = TRUE;
   LPSTR lpOBPrintBuf;

   /* Show and get the print terminal dialog box.
    */
   if( !Adm_Dialog( hRscLib, hwnd, MAKEINTRESOURCE(IDDLG_PRINTOUTBASKET), PrintOutbasketDlg, 0L ) )
      return;

   fNewMemory( &lpOBPrintBuf, LEN_TEMPBUF );
   GetWindowText( hwnd, lpOBPrintBuf, LEN_TEMPBUF );
   if(   NULL != ( hPr = BeginPrint( hwnd, lpOBPrintBuf, &lfFixedFont ) ) )
      {
      register int cCount;

      for( cCount = 0; fOk && cCount < cCopies; ++cCount )
         {

      int nCount;
      int c;
      HWND hwndList;

      ResetPageNumber( hPr );
      fOk = BeginPrintPage( hPr );

      hwndList = GetDlgItem( hwnd, IDD_LIST );

      nCount = ListBox_GetCount( hwndList );
      for( c = 0; c != nCount; c++ )
         {
         OBINFO obinfo;
         LPOB lpob;

         lpob = (LPOB)ListBox_GetItemData( hwndList, c );
         Amob_GetObInfo( lpob, &obinfo );
         Amob_Describe( lpob, lpOBPrintBuf );
         if( TestF(obinfo.obHdr.wFlags, OBF_HOLD) )
            wsprintf( lpOBPrintBuf, "%s (H)", lpOBPrintBuf );
         if( TestF(obinfo.obHdr.wFlags, OBF_KEEP) )
            wsprintf( lpOBPrintBuf, "%s (K)", lpOBPrintBuf );
         if( fOk )
            fOk = PrintLine( hPr, lpOBPrintBuf );
         }
      if( fOk )
         EndPrintPage( hPr );
      }
      }
   EndPrint( hPr );
   if( NULL != lpOBPrintBuf )
      FreeMemory( &lpOBPrintBuf );
}
コード例 #2
0
ファイル: PRNSETUP.CPP プロジェクト: cdaffara/symbiandump-mw1
EXPORT_C void CPrintSetup::CreatePrinterDeviceL(TInt aModelIndex)
/** Selects the target printer device by its index into the list of printer models.

Unlike the other overload of this function, a panic occurs if no printer model 
list has previously been created using ModelNameListL().

If a print process is taking place when this function is called, it is aborted.

The existing printer device's page specification is preserved.

@param aModelIndex Index of the printer device into the list of printer devices.
@leave KErrNoMemory There is insufficient memory to perform the operation. */
	{
	__ASSERT_ALWAYS(iModelList,Panic(EPanicNoModelList));
	//
	CPrinterDriver* printerDriver = iModelList->CreatePrinterDriverL(aModelIndex);
	if (iPrinterDriver)
		{
		EndPrint(); // just in case we're printing at the time
		printerDriver->PrinterDevice()->SelectPageSpecInTwips(iPrinterDriver->PrinterDevice()->CurrentPageSpecInTwips());
		delete iPrinterDriver;
		}
	iPrinterDriver = printerDriver;
	}