當前位置: 首頁>>代碼示例>>C++>>正文


C++ EndPage函數代碼示例

本文整理匯總了C++中EndPage函數的典型用法代碼示例。如果您正苦於以下問題:C++ EndPage函數的具體用法?C++ EndPage怎麽用?C++ EndPage使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了EndPage函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetProfileString

void CComPrint::PrintBmp(UINT nBmpId)
{
	char szPrinter[200] = "";
	char *pszDevice = NULL;
	char *pszDriver = NULL;
	char *pszOutput = NULL;

	HDC hdcPrint = NULL; // 定義一個設備環境句柄

	static DOCINFO di={sizeof(DOCINFO),"printer",NULL};

	// 得到設備字符串存入數組szPrinter中
	GetProfileString("windows","device",",,,",szPrinter,80); 

	// 將設備字符串分解
	if( (NULL != (pszDevice = strtok(szPrinter,","))) && 
		(NULL != (pszDriver = strtok(NULL,","))) &&
		(NULL != (pszOutput = strtok(NULL,","))))
	{
		// 創建一個打印機設備句柄
		if((hdcPrint = CreateDC(pszDriver,pszDevice, pszOutput, NULL)) != 0)
		{ 
			if (StartDoc(hdcPrint, &di) > 0)	//開始執行一個打印作業 
			{ 
				StartPage(hdcPrint);			//打印機走紙,開始打印 
				SaveDC(hdcPrint);				//保存打印機設備句柄

				#pragma warning(disable:4312)

				// 輸出圖片
				HBITMAP hBitmap=::LoadBitmap(AfxGetInstanceHandle(),(LPCTSTR)nBmpId);
				BITMAP bitmap;
				::GetObject(hBitmap,sizeof(BITMAP),&bitmap);

				#pragma warning(default:4312)

				HDC dcMem;
				dcMem=::CreateCompatibleDC(hdcPrint);
				HBITMAP hOldBmp=(HBITMAP)::SelectObject(dcMem,hBitmap);

				int nVertCenterPos = ::GetDeviceCaps(hdcPrint, VERTRES) / 2;
				::StretchBlt(hdcPrint,1,50,400,bitmap.bmHeight,dcMem,0,0,bitmap.bmWidth,bitmap.bmHeight,SRCCOPY);

				::SelectObject(dcMem,hOldBmp);
				::DeleteDC(dcMem);
				::DeleteObject(hBitmap);

				RestoreDC(hdcPrint,-1); //恢複打印機設備句柄 
				EndPage(hdcPrint); //打印機停紙,停止打印 
				EndDoc(hdcPrint); //結束一個打印作業 
			} 

			// 用API函數DeleteDC銷毀一個打印機設備句柄 
			DeleteDC(hdcPrint);
		}
	}
}
開發者ID:tempbottle,項目名稱:TestSet,代碼行數:57,代碼來源:ComPrint.cpp

示例2: finishPage

int finishPage(const int pdcID) {
    HDC pdc = printerDCs[pdcID];
    if (pdc != NULL) {
        if (EndPage(pdc) > 0) {
            return JNI_TRUE;
        }
    }
    return JNI_FALSE;
}
開發者ID:hzwjava,項目名稱:ORDER,代碼行數:9,代碼來源:print.cpp

示例3: apc_prn_new_page

Bool
apc_prn_new_page( Handle self)
{
   apcErrClear;
   objCheck false;
   if ( EndPage( sys ps) < 0) apiPrnErr;
   if ( StartPage( sys ps) < 0) apiPrnErr;
   return apcError == errOk;
}
開發者ID:Absolight,項目名稱:Prima,代碼行數:9,代碼來源:dev.c

示例4: cdflush

/* 
%F cdFlush para Printer.
Termina uma pagina e inicia outra.
*/
static void cdflush(cdCtxCanvas* ctxcanvas)
{
  delete ctxcanvas->graphics;
  EndPage(ctxcanvas->hDC);

  StartPage(ctxcanvas->hDC);
  ctxcanvas->graphics = new Graphics(ctxcanvas->hDC, ctxcanvas->printerHandle);

  cdwpUpdateCanvas(ctxcanvas);
}
開發者ID:LuaDist,項目名稱:cd,代碼行數:14,代碼來源:cdwprnp.cpp

示例5: gdi_abort

/*
 * Clean up the GDI data structures without attempting any more printing.
 */
static void
gdi_abort(void)
{
    if (pstate.out_row) {
	(void) EndPage(pstate.dlg.hDC);
	pstate.out_row = 0;
    }
    (void) EndDoc(pstate.dlg.hDC);

    cleanup_fonts();
}
開發者ID:Oxyoptia,項目名稱:x3270,代碼行數:14,代碼來源:gdi_print.c

示例6: SimplePrint

void SimplePrint(int nPages)
{
	TCHAR temp[MAX_PATH];

	DWORD size = MAX_PATH;
	GetDefaultPrinter(temp, & size); // default printer name

	HDC hDC = CreateDC(NULL, temp, NULL, NULL); // DC with default setting
	
	if ( hDC )
	{
		nCall_AbortProc = 0;
		SetAbortProc(hDC, SimpleAbortProc);

		DOCINFO docinfo;
		docinfo.cbSize       = sizeof(docinfo);
		docinfo.lpszDocName  = _T("SimplePrint");
		docinfo.lpszOutput   = NULL; 
		docinfo.lpszDatatype = _T("EMF");
		docinfo.fwType		 = 0; 

		if ( StartDoc(hDC, & docinfo) > 0 )
		{
			for (int p=0; p<nPages; p++) // one page at a time
				if ( StartPage(hDC) <= 0 )
					break;
				else
				{
					int width  = GetDeviceCaps(hDC, HORZRES);
					int height = GetDeviceCaps(hDC, VERTRES);
					int dpix   = GetDeviceCaps(hDC, LOGPIXELSX);
					int dpiy   = GetDeviceCaps(hDC, LOGPIXELSY);
			
					wsprintf(temp, _T("Page %d of %d"), p+1, nPages);
					SetTextAlign(hDC, TA_TOP | TA_RIGHT );
					TextOut(hDC, width, 0, temp, _tcslen(temp));

					Rectangle(hDC, 0, 0, dpix, dpiy);
					Rectangle(hDC, width, height, width-dpix, height-dpiy);
				
					if ( EndPage(hDC)<0 )
						break;
				}
			
			EndDoc(hDC);
		}

		DeleteDC(hDC);
	}

	wsprintf(temp, "AbortProc called %d times", nCall_AbortProc);
	MessageBox(NULL, temp, "SimlePrint", MB_OK);	
}
開發者ID:b2kguga,項目名稱:CodesAndNotes,代碼行數:53,代碼來源:Printer.cpp

示例7: dlg

void Editor::print(){

	static const int MARG=720;	//1440=1 inch

	CPrintDialog dlg(false);
	int e=dlg.DoModal();if( e==IDCANCEL ) return;

	HDC hdc=dlg.GetPrinterDC();
	if( !hdc ){
		MessageBox( "Error printing" );
		return;
	}

	int hr=GetDeviceCaps(hdc,HORZRES),vr=GetDeviceCaps(hdc,VERTRES);
	int px=GetDeviceCaps(hdc,LOGPIXELSX),py=GetDeviceCaps(hdc,LOGPIXELSY);

	SetMapMode(hdc,MM_TEXT);

	FORMATRANGE fr={0};
	fr.hdc=fr.hdcTarget=hdc;
	fr.rcPage.left=fr.rcPage.top=0;
	fr.rcPage.right=(hr/px)*1440;
	fr.rcPage.bottom=(vr/py)*1440;

	//margins
	fr.rc.left=fr.rcPage.left+MARG;
	fr.rc.top=fr.rcPage.top+MARG;
	fr.rc.right=fr.rcPage.right-MARG;
	fr.rc.bottom=fr.rcPage.bottom-MARG;

	char buff[MAX_PATH];
	strcpy( buff,name.c_str() );

	DOCINFO di={sizeof(di)};
	di.lpszDocName=buff;

	getSel();
	int start=selStart,end=selEnd;
	if( start==end ){ start=0;end=editCtrl.GetTextLength(); }

	StartDoc(hdc,&di);
	while( start<end ){
		StartPage(hdc);
		fr.chrg.cpMin=start;
		fr.chrg.cpMax=end;
		start=editCtrl.FormatRange(&fr,true);
		EndPage(hdc);
	}
	EndDoc(hdc);

	editCtrl.FormatRange(0,false);
	DeleteDC(hdc);
}
開發者ID:kfprimm,項目名稱:blitz3d-ng,代碼行數:53,代碼來源:editor.cpp

示例8: cdkillcanvas

/* 
%F cdKillCanvas para Printer.
Termina a pagina e termina o documento, enviando-o para a impressora.
*/
static void cdkillcanvas (cdCtxCanvas *ctxcanvas)
{
  EndPage(ctxcanvas->hDC);
  EndDoc(ctxcanvas->hDC);
  
  cdwKillCanvas(ctxcanvas);
  
  DeleteDC(ctxcanvas->hDC);
  
  memset(ctxcanvas, 0, sizeof(cdCtxCanvas));
  free(ctxcanvas);
}
開發者ID:gcfavorites,項目名稱:tastools,代碼行數:16,代碼來源:cdwprn.c

示例9: cdkillcanvas

/* 
%F cdKillCanvas para Printer.
Termina a pagina e termina o documento, enviando-o para a impressora.
*/
static void cdkillcanvas (cdCtxCanvas* ctxcanvas)
{
  cdwpKillCanvas(ctxcanvas);
  
  EndPage(ctxcanvas->hDC);
  EndDoc(ctxcanvas->hDC);

  ClosePrinter(ctxcanvas->printerHandle);
  DeleteDC(ctxcanvas->hDC);
  
  delete ctxcanvas;
}
開發者ID:LuaDist,項目名稱:cd,代碼行數:16,代碼來源:cdwprnp.cpp

示例10: NewPage

BOOL
NewPage(
    IN HANDLE PrinterDC
    )

/*++

Routine Description:

    NewPage - Do printer EndPage and StartPage. Reset NumLines.

Arguments:

    PrinterDC - HDC of the printer

Return Value:

    BOOL - TRUE if we got a valid Printer DC, FALSE otherwise.

--*/

{

    int nError;

    nError = EndPage( PrinterDC );

    if (nError <= 0) {

        // PrinterError( hWnd, PrinterDC, (LPTSTR) GetString( IDS_END_PAGE ) );

        return FALSE;
    }
    nError = StartPage( PrinterDC );

    if (nError <= 0) {

        // PrinterError( hWnd, PrinterDC, (LPTSTR) GetString( IDS_START_PAGE ) );

        return FALSE;
    }

    //
    // Set the current line number to the top of the page.
    //

    LineNumber = 1;

    return TRUE;
}
開發者ID:mingpen,項目名稱:OpenNT,代碼行數:50,代碼來源:printer.c

示例11: print

static bool print(ITile *pDraw)
{
	PRINTDLG pd = {0};
	pd.lStructSize = sizeof pd;

	/* 
	 * get rid of PD_RETURNDEFAULT on the line below if you'd like to
	 * see the "Printer Settings" dialog!
	 *
	 */
	pd.Flags = PD_RETURNDEFAULT | PD_RETURNDC;

	// try to retrieve the printer DC
	if( !PrintDlg(&pd) )
	{
		return false;
	}

	DOCINFO di = {0};
	HDC hPrinter = pd.hDC;

	// initialization of the printing!

	// start the first and only page

	Printer canvas(hPrinter);

	RECT rect = {0};
	canvas.GetClipBox(&rect);
	Tiles::rect_t wrect;
	wrect.x = rect.left;
	wrect.y = rect.top;
	wrect.wide = rect.right - rect.left;
	wrect.high = rect.bottom - rect.top;
	pDraw->setRect(wrect);

	pDraw->Draw(&canvas, false);

	// uncomment the following line to print in colour! :)
	// SetTextColor( hPrinter, 0x0000FF );

	// finish the first page
	EndPage( hPrinter );

	// end this document and release the printer's DC
	EndDoc( hPrinter );
	//DeleteDC( hPrinter );
	return true;
}
開發者ID:Unitrunker,項目名稱:Tile,代碼行數:49,代碼來源:Printer.cpp

示例12: EndDocument

/*****************************************************************************
 End document
 Done on PRINT CLOSE
*****************************************************************************/
static void EndDocument(void)
{
   DeleteObject( SelectObject( pd.hDC, hOldFont ) );
   if (defaultprinter)
   {
     EndPage( pd.hDC );
     EndDoc( pd.hDC );
   }
   else
   {
     EndPagePrinter( hPrinter );
     EndDocPrinter( hPrinter );
   }
   documentON = FALSE;
}
開發者ID:ErisBlastar,項目名稱:osfree,代碼行數:19,代碼來源:print.c

示例13: GPdestroywidget

int GPdestroywidget (Gwidget_t *widget) {
    HENHMETAFILE mfile;

    if (WPU->mode == 1) {
        mfile = CloseEnhMetaFile (GC);
        OpenClipboard (NULL);
        EmptyClipboard ();
        SetClipboardData (CF_ENHMETAFILE, mfile);
        CloseClipboard ();
        DeleteMetaFile (mfile);
    } else {
        EndPage (GC);
        EndDoc (GC);
    }
    return 0;
}
開發者ID:AhmedAMohamed,項目名稱:graphviz,代碼行數:16,代碼來源:gpcanvas.c

示例14: endPaint

void MacPrinterCanvas::finish() {
	if (!hdc) {return;}
	endPaint();
	//if (!Escape(hdc, NEWFRAME, 0, NULL, NULL)) {
		//DebugMessage("NEWFRAME failed\n");
	//	abort();
	//}
	//if (!Escape(hdc, ENDDOC, 0, NULL, NULL)) {
		//DebugMessage("ENDDOC failed\n");
	//	abort();
	//}
	EndPage(hdc);
	EndDoc(hdc);
	DeleteDC(hdc);
	hdc = 0;
}
開發者ID:neurodebian,項目名稱:iv-hines,代碼行數:16,代碼來源:mprinter.cpp

示例15: apc_prn_end_doc

Bool
apc_prn_end_doc( Handle self)
{
   apcErrClear;

   objCheck false;
   if ( EndPage( sys ps) < 0) apiPrnErr;
   if ( EndDoc ( sys ps) < 0) apiPrnErr;

   hwnd_leave_paint( self);
   if ( sys pal) DeleteObject( sys pal);
   DeleteDC( sys ps);
   sys pal = nil;
   sys ps = nil;
   return apcError == errOk;
}
開發者ID:Absolight,項目名稱:Prima,代碼行數:16,代碼來源:dev.c


注:本文中的EndPage函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。