本文整理汇总了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);
}
}
}
示例2: finishPage
int finishPage(const int pdcID) {
HDC pdc = printerDCs[pdcID];
if (pdc != NULL) {
if (EndPage(pdc) > 0) {
return JNI_TRUE;
}
}
return JNI_FALSE;
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}