Google Búsqueda personalizada

Regístrate gratis para participar de los foros, o si ya estás registrado haz login.

Como se programa el puerto paralelo en c++ para ingresar

comentario del autor Lun Jun 27, 2005 11:06 pm
   
Como se programa el puerto paralelo en C++ para ingresar datos
Los datos salen barbaro pero para entrar no puedo programar.

MACGODFATHER

Reputación

comentario Lun Jul 04, 2005 2:59 pm
   
prueba este codigo
/*********************************************************************
*
* 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! Smile
// 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)

rubenvelazquez

Reputación



Hacer una pregunta

Boletín de Noticias

Reciba noticias de tecnología, tips de reparación y ofertas exclusivas.



Reglamento / P+F

Foros

Miembros / Expertos