elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  puertos c++
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: puertos c++  (Leído 7,157 veces)
julyos

Desconectado Desconectado

Mensajes: 59


Ver Perfil
puertos c++
« en: 7 Mayo 2005, 18:40 pm »

quiero en verdad que me ayuden un poco con el manejo de puertos como aheclr para controlar mi puerto paralelo por un codigo en c++ me gustaria que ma ayudaran con un codigo ejemplo


En línea

Griph

Desconectado Desconectado

Mensajes: 252


Ver Perfil
Re: puertos c++
« Respuesta #1 en: 7 Mayo 2005, 19:46 pm »

En el sitio http://www.cplusplus.com/src/ hay una aplicación, en código fuente, programada en justamente en C++. Es un programa para controlar la impresora (por consiguiente el puerto paralelo), te decía este sitio porque casualmente ayer en la noche yo estuve vajando algunos códigos.

Griph

PD: no te pego acá el código fuente porque es muy extenso, mejor bajálo vos (esta un fichero comprimido bajo el algoritmo zip).

Edito el post y te pego el código fuente:

Código:
/*********************************************************************
 *
 * 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;
}



« Última modificación: 10 Mayo 2005, 03:46 am por Griph » En línea

"...la Base está en Aprender a Programar..."
oosathiray

Desconectado Desconectado

Mensajes: 1


Ver Perfil
Re: puertos c++
« Respuesta #2 en: 6 Marzo 2015, 08:49 am »

código fuente porque es muy extenso, mejor bajálo vos ???
En línea

raza
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines