Hi,
I'm trying to write a program to print some text on a page. I did some research and found out how to achieve it basicly:
However, i'm trying to print text written by the user, so i don't have any idea how much pages it will take. Obviously, i won't be able to use the StartPage-EndPage structure. So how can i make this work for variable amount of text?Code:PRINTDLG pd; memset( &pd, 0, sizeof( pd ) ); pd.lStructSize = sizeof( pd ); pd.Flags = PD_RETURNDEFAULT | PD_RETURNDC; if( !PrintDlg( &pd ) ) { MessageBox( NULL, "PrintDlg( &pd ) failed!", "Fatal Error", MB_OK ,MB_ICONERROR ); return -1; } DOCINFO di; HDC hPrinter = pd.hDC; memset( &di, 0, sizeof( di ) ); di.cbSize = sizeof( di ); StartDoc( hPrinter, &di ); StartPage( hPrinter ); TextOut( hPrinter, 100, 100, "Hello, world", 12); EndPage( hPrinter ); EndDoc( hPrinter ); DeleteDC( hPrinter );



LinkBack URL
About LinkBacks


