16,551
社区成员
发帖
与我相关
我的任务
分享
#0001 void CView::OnFilePrint()
#0002 {
#0003 // get default print info
#0004 CPrintInfo printInfo;
#0005 ASSERT(printInfo.m_pPD != NULL); // must be set
#0006
#0007 if (GetCurrentMessage()->wParam == ID_FILE_PRINT_DIRECT)
#0008 {
#0009 CCommandLineInfo* pCmdInfo = AfxGetApp()->m_pCmdInfo;
#0010
#0011 if (pCmdInfo != NULL)
#0012 {
#0013 if (pCmdInfo->m_nShellCommand == CCommandLineInfo::FilePrintTo)
#0014 {
#0015 printInfo.m_pPD->m_pd.hDC = ::CreateDC(pCmdInfo->m_strDriverName,
#0016 pCmdInfo->m_strPrinterName, pCmdInfo->m_strPortName, NULL);
#0017 if (printInfo.m_pPD->m_pd.hDC == NULL)
#0018 {
#0019 AfxMessageBox(AFX_IDP_FAILED_TO_START_PRINT);
#0020 return;
#0021 }
#0022 }
#0023 }
#0024
#0025 printInfo.m_bDirect = TRUE;
#0026 }
printInfo.m_bDirect = TRUE;