FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Pocket PC Nuevo GPF en win CE 6.0 y fwppc2015
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Mon Nov 30, 2015 11:32 PM
Buenas noches Antonio,

¿ Tienes idea por qué el siguiente código para conocer las carpetas del SO, funciona, pero si la llamo varias veces, al final da una especie de gpf como con el problema del curdir() del anterior mensaje. ?

Creo que tiene relación con la función WideToAnsi, pero no encuentro qué puede ser. Adjunto el código problemático:

Code (fw): Select all Collapse
HB_FUNC( CESPECIALFOLDERDOMI )
{
  LPTSTR lpszPath = ( LPTSTR ) hb_xgrab( MAX_PATH );
  LPSTR   pAnsi;
  BOOL     bRet ;
                                 // (HWND) GetActiveWindow()
  bRet = SHGetSpecialFolderPath( NULL, lpszPath , (INT) hb_parni(1) , 0 );

  hb_retl( (BOOL) bRet );

  if ( bRet )
   {
      pAnsi = WideToAnsi( ( LPWSTR ) lpszPath );

      if ( ISBYREF( 2 ) )                    // Quitamos el Null del final
         hb_storclen( ( char * ) pAnsi, MAX_PATH, 2 ) ;

      hb_xfree( pAnsi );

   }
  else
   {
      if ( ISBYREF( 2 ) )                    // Mandamos cadena vacía
         hb_storclen( ( char * ) lpszPath, 0 , 2 ) ;
   }

  hb_xfree( lpszPath );

}
Un Saludo,

Joaquín Martínez
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Mon Nov 30, 2015 11:50 PM
Antonio,

Si después de cada llamada a la función anterior, hago una llamada a la función CESysRefresh(), ya funciona por muchas llamadas que haga.

¿De donde podrá venir el problema?

Adjunto función:

Code (fw): Select all Collapse
HB_FUNC( CESYSREFRESH )
{
  MSG msg;

  if(PeekMessage(&msg, 0, 0, 0, 1))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

  hb_ret();
}
Un Saludo,

Joaquín Martínez
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Tue Dec 01, 2015 08:33 AM

Joaquín,

Mira a ver si te genera un archivo hb_out.log y muéstrame el contenido, gracias

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Tue Dec 01, 2015 09:44 AM

No Antonio,

No genera nada.

Si puedes decirme como generar un fichero de traza de la aplicación para poder detectar errores o pérdidas de memoria, te lo agradecería.

Un Saludo,

Joaquín Martínez
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Tue Dec 01, 2015 09:50 AM
El fichero hb_out.log debería generarlo Harbour automaticamente

Prueba asi:
http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_setresdebug
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Tue Dec 01, 2015 10:57 AM

Antonio,

En fwppc no funciona, genera este error compilando:

error LNK2001: unresolved external symbol HB_FUN_SETRESDEBUG

Un Saludo,

Joaquín Martínez
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Tue Dec 01, 2015 02:27 PM
Joaquín,

Habría que añadir el módulo checkres.prg de FWH a FWPPC.

Aqui tienes el código
Code (fw): Select all Collapse
#include "FiveWin.ch"

static aResources := {}

//----------------------------------------------------------------------------//

function SetResDebug( lOnOff ) // for backwards compatibility

return nil

//----------------------------------------------------------------------------//

function FWAddResource( nHResource, cType )

   local n := 3, cInfo := ""

   while ! Empty( ProcName( n ) )
      cInfo += ProcName( n ) + "(" + Alltrim( Str( ProcLine( n ) ) ) + ")->"
      n++
   end
   
   if ! Empty( cInfo )
      cInfo = SubStr( cInfo, 1, Len( cInfo ) - 2 )
   endif   
      
   AAdd( aResources, { cType, nHResource, cInfo } )
   
return nil   

//----------------------------------------------------------------------------//

function FWDelResource( nHResource )

   local nAt

   if ( nAt := AScan( aResources, { | aRes | aRes[ 2 ] == nHResource } ) ) != 0
      ADel( aResources, nAt )
      ASize( aResources, Len( aResources ) - 1 )
   endif    

return nil

//----------------------------------------------------------------------------//

function CheckRes()

   local cInfo := "", n
   
   for n = 1 to Len( aResources )
      if aResources[ n, 2 ] != 0
         cInfo = GetModuleFileName( GetInstance() ) + " -- " + ;
                 aResources[ n, 1 ] + "," + AllTrim( Str( aResources[ n, 2 ] ) ) + ;
                  "," + aResources[ n, 3 ] + CRLF
         LogFile( "checkres.txt", { cInfo } )
      endif
   next   

   LogFile( "checkres.txt", { GetModuleFileName( GetInstance() ) + " -- " + ;
                              Replicate( "=", 100 ) } )   
   
return nil   

//---------------------------------------------------------------------------//

#pragma BEGINDUMP

#include <windows.h>
#include <hbapiitm.h>
#include <hbvm.h>

void RegisterResource( HANDLE hRes, LPSTR szType )
{
   PHB_ITEM pRet = hb_itemNew( hb_param( -1, HB_IT_ANY ) );

   hb_vmPushSymbol( hb_dynsymGetSymbol( "FWADDRESOURCE" ) );
   hb_vmPushNil();
   hb_vmPushLong( ( LONG ) hRes );
   hb_vmPushString( szType, strlen( szType ) );
   hb_vmFunction( 2 );

   hb_itemReturnRelease( pRet );
}  

void pascal DelResource( HANDLE hResource )
{
   PHB_ITEM pRet = hb_itemNew( hb_param( -1, HB_IT_ANY ) );

   hb_vmPushSymbol( hb_dynsymGetSymbol( "FWDELRESOURCE" ) );
   hb_vmPushNil();
   hb_vmPushLong( ( LONG ) hResource );
   hb_vmFunction( 1 );

   hb_itemReturnRelease( pRet );
}    

#pragma ENDDUMP

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Tue Dec 01, 2015 02:36 PM

Joaquín,

No es necesario hacer lo que te he comentado.

Simplemente no llames a la función SetResDebug(), no hace falta en FWPPC

El módulo checkres.prg ya está incluido en FWPPC

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Tue Dec 01, 2015 04:48 PM

Buenas tardes,

El hb_out.log cuando da gpf si lo crea, pero NO en el directorio de la aplicación, sino en el directorio raíz.

Por otro lado, a mi no me genera nada poniendo checkRes() al terminar la aplicación. No sé como se haría.

Un Saludo,

Joaquín Martínez
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Tue Dec 01, 2015 06:49 PM

Has buscado el fichero checkres.txt ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Wed Dec 02, 2015 09:55 AM

Hombre Antonio,

En el escritorio, en el Raíz y en la carpeta de la aplicación.

No existe.

Un Saludo,

Joaquín Martínez
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Wed Dec 02, 2015 07:10 PM

Joaquín,

Como todo el código está en FWPPC\source\function\checkres.prg podrias poner una traza
en la función CheckRes() para asegurarte de que está pasando por ahí

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 458
Joined: Tue Mar 14, 2006 07:26 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Thu Dec 03, 2015 07:31 PM

Antonio Buenas tardes,

CheckRes.txt se crea perfectamente, unicamente ha sido un error mío, tenía unos defines para depuración y no pasaba por la línea donde ejecutaba checkRes().

Gracias,

Un Saludo,

Joaquín Martínez
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Nuevo GPF en win CE 6.0 y fwppc2015
Posted: Thu Dec 03, 2015 10:02 PM

muy bien

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion