Re: Pass command line file name parameter
Hi Joe,
The following is my replay for your previous replay.
The following is my code:
CPrintDialog prtDlg(false, PD_ALLPAGES);
HDC hdc = prtDlg.CreatePrinterDC();
CDC dc;
dc.Attach (hdc);
LPDOCINFO docInfo;
int rtn = dc.StartDoc(docInfo);
There's an error:
Program:myapp.exe
File:afxwin1.inl
Debug points to line in afxwin1.inl:
_AFXWIN_INLINE int CDC::StartDoc(LPDOCINFO lpDocInfo)
{ ASSERT(m_hDC != NULL); return ::StartDoc(m_hDC, lpDocInfo); }
I wonder docInfo which points to aDOCINFO structure should initialize
lpszDocName. I'm not print document from a file, but the formated data
stored in CStringArray. What can I do?
Do I need to access CPrintInfo Class Members while printing and how?
Thanks,
ybc
"Joseph M. Newcomer" wrote:
You can directly invoke the Print Dialog using the flags to return the printer DC for the
default printer (no UI pops up); this is one of the most expedient ways of getting the
printer DC. Just give it a parent window handle of NULL. After that, it's just
programming. Use a console app, enable MFC in it if you want to use CString (for VS.NET,
I've not looked into what is involved to get just the CString components; maybe someone
can post an answer that avoids bringing the whole MFC runtime in...)
joe
On Wed, 26 Jul 2006 23:02:01 -0700, ybc <ybc@discussions.microsoft.com> wrote:
Hi,
I try to create a non-user interface program which gets file name from
command line, open and format the document, and print the labels. What
application framework can be used? How process print with MFC? Detailed
information is appreciated.
Thanks,
ybc
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm