Búsqueda personalizada
Regístrate gratis para participar de los foros, o si ya estás registrado haz login.
| comentario del autor | Lun Jun 27, 2005 11:06 pm | |
|
Los datos salen barbaro pero para entrar no puedo programar. |
||
| comentario | Lun Jul 04, 2005 2:59 pm | |
|
/********************************************************************* * * hwprint.cpp by Tom Lee * * Example program to demonstrate printing using the Win32 API/GDI. * I'm new to printing with the Win32 GDI myself (although I've * used the GDI heaps before for gfx etc.) - I've been * trying for a long time to find useful info on the Internet * about this very thing, but came across next to nothing. * I thought it'd be a disservice to the Internet not to get * something about printing with Win32/GDI out the door ASAP! * * ------------------------------------------------------------------- * * Libraries to link in: * * kernel32.lib, user32.lib, gdi32.lib, comdlg32.lib * ********************************************************************/ #include <windows.h> int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nCmdShow ) { PRINTDLG pd; memset( &pd, 0, sizeof( pd ) ); 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 ) ) { MessageBox( NULL, "PrintDlg( &pd ) failed!", "Fatal Error", MB_OK | MB_ICONERROR ); return -1; } DOCINFO di; HDC hPrinter = pd.hDC; // initialization of the printing! memset( &di, 0, sizeof( di ) ); di.cbSize = sizeof( di ); StartDoc( hPrinter, &di ); // start the first and only page StartPage( hPrinter ); // uncomment the following line to print in colour! // SetTextColor( hPrinter, 0x0000FF ); // write "Hello, World!" to the printer's DC TextOut( hPrinter, 100, 100, "Hello, World!", 13 ); // finish the first page EndPage( hPrinter ); // end this document and release the printer's DC EndDoc( hPrinter ); DeleteDC( hPrinter ); return 0; } para mas referencia visita (url=http://www.cplusplus.com/src/url) |
||