Antonio Linares wrote:Toninho,
You are not using SizeofResource() which it is needed.
Also you are not checking for wrong returned values! You are assuming that everything will be found, which can not be the case.
Hi Antonio and Vailton,
It is intentional, only to simplify my code, but lets go, here is the full code, that doesn´t work:
Code: Select all
HB_FUNC( CRESTOSTR )
{
HRSRC hRes = FindResource( ( HINSTANCE ) GetResources(), ( LPCSTR ) ( ISNUM( 1 ) ? ( LPCSTR ) hb_parnl( 1 ) : hb_parc( 1 ) ), ( LPCSTR ) hb_parnl( 2 ) );
HANDLE hglb;
if( hRes )
{
hglb = LoadResource( ( HINSTANCE ) GetResources(), hRes );
if( hglb )
{
hb_retclen( ( LPSTR ) LockResource( hglb ), GlobalSize( hglb ) );
}
else
{
hb_retc( "" );
}
}
else
{
hb_retc( "" );
}
}
To test it:
Code: Select all
? Len( crestostr( 7777, "BITMAP" ) )
This code is the original crestostr from FWH.
What is wrong please?
Regards,
Toninho.