Página 1 de 1

Clase TInternet. Mensajes en castellano

Publicado: Vie Sep 04, 2020 10:48 am
por josemanuel
En la clase TInternet, el método ::GetErrorDescription(),
como hacer para que los mensajes de error los presente en castellano?

Re: Clase TInternet. Mensajes en castellano

Publicado: Vie Sep 04, 2020 12:42 pm
por ignacio
Buenos días,

No creo que funcione, pero cambia esta función en Internet.prg:

HB_FUNC_STATIC( XINTERNET_GETERRORDESCRIPTION )
{
PHB_ITEM Self = hb_stackSelfItem();
DWORD dwError = HB_ISNUM( 1 ) ? hb_parnl( 1 ) : XA_ObjGetNL( Self, "nLastError" );

if( ! ( dwError == ERROR_INTERNET_EXTENDED_ERROR ) )
{
HMODULE hModule = GetModuleHandle( "wininet.dll" );
char * szBuffer = hb_xgrab( 1024 );

if( FormatMessage( FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_HMODULE,
hModule, dwError,
MAKELANGID( LANG_SYSTEM_DEFAULT, SUBLANG_DEFAULT ),
(LPTSTR) szBuffer, 1023, NULL ) )
hb_retc( szBuffer );
else
hb_retc( "" );
hb_xfree( szBuffer );
}
else
{
LPTSTR lpBuffer;
DWORD dwErr;
DWORD dwLen = 0;

InternetGetLastResponseInfo( &dwErr, NULL, &dwLen );

if( dwLen )
{
lpBuffer = hb_xgrab( ( dwLen + 1 ) * sizeof( TCHAR ) );
InternetGetLastResponseInfo( &dwErr, lpBuffer, &dwLen );

hb_retc( lpBuffer );
hb_xfree( lpBuffer );
}
else
hb_retc( "" );
}
}

Re: Clase TInternet. Mensajes en castellano

Publicado: Vie Sep 04, 2020 1:13 pm
por josemanuel
No funciona

Re: Clase TInternet. Mensajes en castellano

Publicado: Lun Sep 07, 2020 10:57 am
por ignacio
Hola,

Me lo temía. Poco más se puede hacer. Lo siento.

Un saludo