FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour de C a xHarbour
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: de C a xHarbour

Posted: Thu Jun 11, 2009 01:00 PM
Pablo,

Ok, ya vi lo que pasa :-) SPP_DEVICE_INFO es un puntero. Tenemos que usar SP_DEVICE_INFO:

Code (fw): Select all Collapse
HB_FUNC( SFNTGETDEVICEINFO )
{
   SP_DEVICE_INFO deviceInfo;

   hb_retnl( SFNTGetDeviceInfo( ( SP_HANDLE ) hb_parnl( 1 ), &deviceInfo ) );  // OJO al &
   hb_storclen( ( char * ) deviceInfo, sizeof( SP_DEVICE_INFO ), 2 );
}

Y
Code (fw): Select all Collapse
HB_FUNC( SFNTGETDEVICEINFO )
{
   SP_DEVICE_INFO deviceInfo;

   SFNTGetDeviceInfo( ( SP_HANDLE ) hb_parnl( 1 ), &deviceInfo );

   hb_reta( 10 ); // vamos a devolver un array de 10 elementos

   hb_stornl( ( LONG ) deviceInfo.formFactorType, -1, 1 );
   hb_stornl( ( LONG ) deviceInfo.productCode, -1, 2 );
   hb_stornl( ( LONG ) deviceInfo.hardlimit, -1, 3 );
   hb_stornl( ( LONG ) deviceInfo.capabilities, -1, 4 );
   hb_stornl( ( LONG ) deviceInfo.devID, -1, 5 );
   hb_stornl( ( LONG ) deviceInfo.devSN, -1, 6 );
   hb_stornl( ( LONG ) deviceInfo.timeValue, -1, 7 );
   hb_stornl( ( LONG ) deviceInfo.memorySize, -1, 8 );
   hb_stornl( ( LONG ) deviceInfo.freeSize, -1, 9 );
   hb_stornl( ( LONG ) deviceInfo.drvVersion, -1, 10 );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 401
Joined: Thu Oct 06, 2005 10:15 PM

Re: de C a xHarbour ( SOLUCIONADO )

Posted: Thu Jun 11, 2009 01:11 PM
Ufff... por fin!!!!

Antonio al Final la funcion quedo asi:
Code (fw): Select all Collapse
HB_FUNC( SFNTGETDEVICEINFO )
{
   SPP_DEVICE_INFO deviceInfo;
   SFNTGetDeviceInfo( ( SP_HANDLE ) hb_parnl( 1 ), deviceInfo ); //<-Quite el &

   hb_reta(6);
   hb_stornl( ( LONG ) deviceInfo->timeValue.year, -1, 1 ); // <- Quite el "." y puse "->"
   hb_stornl( ( LONG ) deviceInfo->timeValue.month, -1, 2 );
   hb_stornl( ( LONG ) deviceInfo->timeValue.dayOfMonth, -1, 3 );
   hb_stornl( ( LONG ) deviceInfo->timeValue.hour, -1, 4 );
   hb_stornl( ( LONG ) deviceInfo->timeValue.minute, -1, 5 );
   hb_stornl( ( LONG ) deviceInfo->timeValue.second, -1, 6 );
}


y Funciono Perfecto... De esta funcion solo necesito acceder a la fecha y hora del dispositivo

MUUUUUUUUCHAS GRACIAS ANTONIO
Saludos,



Pablo Alberto Vidal

/*

------------------------------------------------------

Harbour 3.2.0, Fivewin 17.02, BCC7

------------------------------------------------------

*/
Posts: 401
Joined: Thu Oct 06, 2005 10:15 PM

Re: de C a xHarbour

Posted: Thu Jun 11, 2009 02:38 PM
Antonio,
Como dicen por aqui, "Nunca Falta un pelo en la sopa"

La funcion me devuelve el Array perfecto... No hay problema con eso
El asunto es que cuando hago esto

Code (fw): Select all Collapse
 cRetorno := SFNTGetDeviceInfo( hHeader )
 ? cRetorno[1] // <- Aqui Funciona bien, me devuelve el año
 ? ValType( cRetorno[1] ) // <- Aqui error


Me da error...
Saludos,



Pablo Alberto Vidal

/*

------------------------------------------------------

Harbour 3.2.0, Fivewin 17.02, BCC7

------------------------------------------------------

*/
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: de C a xHarbour

Posted: Thu Jun 11, 2009 04:11 PM
Pablo,

? ValType( cRetorno[1] ) // <- Aqui error


Que error ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 401
Joined: Thu Oct 06, 2005 10:15 PM

Re: de C a xHarbour

Posted: Thu Jun 11, 2009 04:24 PM

Es un error de tiempo de ejecucion un GPF,

Esto ocurre cuando trato de acceder el dato con cualquier funcion de xharbour

Saludos,



Pablo Alberto Vidal

/*

------------------------------------------------------

Harbour 3.2.0, Fivewin 17.02, BCC7

------------------------------------------------------

*/
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: de C a xHarbour

Posted: Thu Jun 11, 2009 04:38 PM
Pablo,

Que valor te muestra aqui ?


? cRetorno[1] // <- Aqui Funciona bien, me devuelve el año
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 401
Joined: Thu Oct 06, 2005 10:15 PM

Re: de C a xHarbour

Posted: Thu Jun 11, 2009 04:43 PM
Me muestra el valor 2009

Hice una prueba ahora,

Sume cRetorno[1] + cRetorno[2] + cRetorno[1] y me sumo bien...

El problema es que si pongo el resultado con dentro de cualquier funcion me da un GPF

EJ.
Code (fw): Select all Collapse
? cRetorno[1] // <- Pasa sin problema, aqui devuelve 2009
? Transform( cRetorno[1], "9999" ) // <- Me da un GPF
Saludos,



Pablo Alberto Vidal

/*

------------------------------------------------------

Harbour 3.2.0, Fivewin 17.02, BCC7

------------------------------------------------------

*/
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: de C a xHarbour

Posted: Thu Jun 11, 2009 07:28 PM

Pablo,

Es muy extraño...

Prueba a asignarle el valor a una variable local:

nValor = cRetorno[1]

y luego usa esa local

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 401
Joined: Thu Oct 06, 2005 10:15 PM

Re: de C a xHarbour

Posted: Thu Jun 11, 2009 08:38 PM

Si ya lo he hecho y nada

Saludos,



Pablo Alberto Vidal

/*

------------------------------------------------------

Harbour 3.2.0, Fivewin 17.02, BCC7

------------------------------------------------------

*/
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: de C a xHarbour

Posted: Fri Jun 12, 2009 06:10 AM

Pablo,

Necesitaríamos construir y probar tu código aqui para poder ayudarte.

Asi, sin ver más, y sin poder probarlo, es casi imposible resolver ese problema.

Envíanos todo lo necesario por email, gracias

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion