Hola Antonio,
Estoy tentando hacer de la manera que me sugeriste, pero al compilar
me da el siguiente error:
xLINK: error: Unresolved external symbol '_HB_FUN_OUTPORTBYTE'.
xLINK: error: Unresolved external symbol '_HB_FUN_INPORTBYTE'.
xLINK: fatal error: 2 unresolved external(s).
Ya tente adicionar la HBComm y nada
posto aqui el codigo:
// *******************************************************************
// Programa Ejercicio 1
//
// Programa para demostrar como un valor decimal en el rango desde 0 a 255
// se vuelca en el puerto LPTn en su forma binaria.
//
// Giancarlo J. Sabattino S.
//
gsabattino@cantv.net
// Valencia - Venezuela
////hBorland :=LoadLibrary( "BWCC32.DLL" ),; // Load Borlands Custom Control DLL
// *******************************************************************
- Code: Select all Expand view
#include "Fivewin.Ch"
function Main()
local oDlg ,;
aPorts :=ScanInstaled(),;
nPort ,;
oCbxPorts ,;
cCbxPorts ,;
aCbxPorts :={},;
nCbxPorts :=1,;
oGetValor ,;
bGetValor :={ || oGetValor:VarPut( nValor ),;
oGetValor:Refresh() },;
nValor :=0,;
oBmpB0 ,;
lBmpB0 ,;
oBmpB1 ,;
lBmpB1 ,;
oBmpB2 ,;
lBmpB2 ,;
oBmpB3 ,;
lBmpB3 ,;
oBmpB4 ,;
lBmpB4 ,;
oBmpB5 ,;
lBmpB5 ,;
oBmpB6 ,;
lBmpB6 ,;
oBmpB7 ,;
lBmpB7 ,;
cLedOn :='Led_Verde',;
cLedOff :='Led_Verde_Off',;
bLeds :={ || OutPortByte( aPorts[ nCbxPorts, 3 ], nValor ),;
lBmpB0 :=lIsBit( nValor, 1 ),;
oBmpB0:SetBmp( iif( lBmpB0, cLedOn, cLedOff ) ),;
lBmpB1 :=lIsBit( nValor, 2 ),;
oBmpB1:SetBmp( iif( lBmpB1, cLedOn, cLedOff ) ),;
lBmpB2 :=lIsBit( nValor, 3 ),;
oBmpB2:SetBmp( iif( lBmpB2, cLedOn, cLedOff ) ),;
lBmpB3 :=lIsBit( nValor, 4 ),;
oBmpB3:SetBmp( iif( lBmpB3, cLedOn, cLedOff ) ),;
lBmpB4 :=lIsBit( nValor, 5 ),;
oBmpB4:SetBmp( iif( lBmpB4, cLedOn, cLedOff ) ),;
lBmpB5 :=lIsBit( nValor, 6 ),;
oBmpB5:SetBmp( iif( lBmpB5, cLedOn, cLedOff ) ),;
lBmpB6 :=lIsBit( nValor, 7 ),;
oBmpB6:SetBmp( iif( lBmpB6, cLedOn, cLedOff ) ),;
lBmpB7 :=lIsBit( nValor, 8 ),;
oBmpB7:SetBmp( iif( lBmpB7, cLedOn, cLedOff ) ),;
oBmpB0:Refresh(),;
oBmpB1:Refresh(),;
oBmpB2:Refresh(),;
oBmpB3:Refresh(),;
oBmpB4:Refresh(),;
oBmpB5:Refresh(),;
oBmpB6:Refresh(),;
oBmpB7:Refresh() },;
oButtEnd
hLib := LoadLib32("inpout32.dll", "BWCC32.DLL")
Set Resources to "Ejemplo1.dll", "BWCC32.DLL"
if len( aPorts )>0
for nPort:=1 to len( aPorts )
aAdd( aCbxPorts, aPorts[ nPort, 1 ]+ '( '+aPorts[ nPort, 2 ]+' )' )
OutPortByte( aPorts[ nPort, 3 ], 0 )
next
Define Dialog oDlg Resource 'Ejemplo1'
REDEFINE COMBOBOX oCbxPorts VAR cCbxPorts;
ITEMS aCbxPorts;
ID 101 OF oDlg;
ON CHANGE ( iif( nCbxPorts#oCbxPorts:nAt,;
( nCbxPorts:=oCbxPorts:nAt,;
eval( bLeds ) ),;
NIL ) )
oCbxPorts:bGotFocus:=bLeds
oCbxPorts:bLostFocus:={ || oGetValor:SetFocus() }
REDEFINE GET oGetValor VAR nValor Picture '999 ';
VALID nValor>=0 .and. nValor<=255;
SPINNER ;
ON CHANGE ( iif( nValor<0,;
( nValor:=255,;
eval( bGetValor ) ),;
iif( nValor>255,;
( nValor:=0,;
eval( bGetValor ) ),;
NIL ) ),;
eval( bLeds ) );
ID 111 of oDlg
REDEFINE BITMAP oBmpB0 Id 201 of oDlg;
ADJUST
REDEFINE BITMAP oBmpB1 Id 202 of oDlg;
ADJUST
REDEFINE BITMAP oBmpB2 Id 203 of oDlg;
ADJUST
REDEFINE BITMAP oBmpB3 Id 204 of oDlg;
ADJUST
REDEFINE BITMAP oBmpB4 Id 205 of oDlg;
ADJUST
REDEFINE BITMAP oBmpB5 Id 206 of oDlg;
ADJUST
REDEFINE BITMAP oBmpB6 Id 207 of oDlg;
ADJUST
REDEFINE BITMAP oBmpB7 Id 208 of oDlg;
ADJUST
REDEFINE BUTTON oButtEnd ID 21 of oDlg;
ACTION oDlg:End()
ACTIVATE DIALOG oDlg;
ON INIT ( oCbxPorts:Select( nCbxPorts ),;
eval( bLeds ) )
else
MsgAlert( 'No hay Adaptadores Paralelo'+CRLF+;
'instalados en este equipo !!!', 'Error !!!' )
endif
freelibrary( hBorland )
DLL32 Function inportb(nPort AS _INT) ;
AS _INT PASCAL FROM "Inp32" ;
LIB "inpout32.dll"
DLL32 Function outportb(nPort AS _INT, nValor AS _INT) ;
AS _INT PASCAL FROM "Out32" ;
LIB "inpout32.dll"
return NIL
#include "Support.Prg"