编写打印程序时遇到的成员函数DrawInfo及MessageBox问题
void CPreviewDlg::DrawInfo(CDC *pmemDC, BOOL isprinted)
{
int xP=GetDeviceCaps(pmemDC->m_hDC,LOGPIXELSX);//x方向每英寸像素点数
int yP=GetDeviceCaps(pmemDC->m_hDC,LOGPIXELSY);//y方向每英寸像素点数
double xPix=(double)xP*10/254;
double yPix=(double)yP*10/254;
int fAdd=int(4.2*yPix);
int nTop=int(32*yPix);
int nBottom=nTop+51*fAdd;
int nLeft=int(30*xPix);
int nRight=int(xPix*(210-30));
CString strTitle;
strTitle.Format("南京工程学院%s",info.xuhao);
TCHAR szTitle[100];
strcpy(szTitle,strTitle);
CRect rc,rt1,rt2,rt3,rt4,rt5,rt6,rt7;
CPen*pOldPen,cPen;
CFont TitleFont,DetailFont,*oldfont;
TitleFont.CreateFont(-MulDiv(16,pmemDC->GetDeviceCaps(LOGPIXELSY),72),0,0,0,FW_NORMAL,0,0,0,GB2312_CHARSET,OUT_STROKE_PRECIS,CLIP_STROKE_PRECIS,
DRAFT_QUALITY,VARIABLE_PITCH|FF_SWISS,_T("黑体"));
DetailFont.CreateFont(-MulDiv(10,pmemDC->GetDeviceCaps(LOGPIXELSY),72),0,0,0,FW_NORMAL,0,0,0,GB2312_CHARSET,OUT_STROKE_PRECIS,CLIP_STROKE_PRECIS,
DRAFT_QUALITY,VARIABLE_PITCH|FF_SWISS,_T("宋体"));
cPen.CreatePen(PS_SOLID,1,RGB(0,0,0));
pOldPen=pmemDC->SelectObject(&cPen);
if(isprinted)
{
static DOCINFO di= {sizeof (DOCINFO), szTitle};
if(pmemDC->StartDoc(&di)<0)
{
MessageBox("连接到打印机失败!","错误",MB_ICONSTOP);
return;
}
if(pmemDC->StartPage()<0)
{
MessageBox(_T("打印失败!"),"错误",MB_ICONSTOP);
pmemDC->AbortDoc();
return;
}
}
}
上面只有打印程序,打印预览程序还没有编,编译运行是出现下面错误。:
D:\HELP\Yujing\PreviewDlg.cpp(28) : error C2039: 'DrawInfo' : is not a member of 'CPreviewDlg'
d:\help\yujing\previewdlg.h(13) : see declaration of 'CPreviewDlg'
D:\HELP\Yujing\PreviewDlg.cpp(63) : error C2660: 'MessageBoxA' : function does not take 3 parameters
D:\HELP\Yujing\PreviewDlg.cpp(68) : error C2660: 'MessageBoxA' : function does not take 3 parameters
希望大神们解答,做毕设的孩子伤不起。。。。