#include "Fivewin.ch"
#define RT_HTML MAKEINTRESOURCE(23)
function main()
msginfo( cResToStr("PAGE", RT_HTML ) )
return
HB_FUNC( CRESTOSTR ) // ( cnResName, cType ) --> cResourceBytes
{
#ifndef UNICODE
HRSRC hRes = FindResource( ( HINSTANCE ) GetResources(),
( LPCSTR ) IF( HB_ISNUM( 1 ), ( LPCSTR ) hb_parnl( 1 ), hb_parc( 1 ) ),
( LPCSTR ) hb_parc( 2 ) );
HGLOBAL hglb;
#else
LPWSTR pW = AnsiToWide( ( char * ) hb_parc( 1 ) );
HRSRC hRes = FindResource( ( HINSTANCE ) GetResources(),
( LPWSTR ) IF( ISNUM( 1 ), ( LPWSTR ) hb_parnl( 1 ), pW ),
( LPWSTR ) hb_parc( 2 ) );
HANDLE hglb;
_xfree( pW );
#endif
if( hRes )
{
hglb = LoadResource( ( HINSTANCE ) GetResources(), hRes );
if( hglb ) // && ! ( GlobalFlags( hglb ) && GMEM_DISCARDED ) )
{
hb_retclen( ( LPSTR ) LockResource( hglb ), SizeofResource( GetResources(), hRes ) );
#ifndef UNICODE
UnlockResource( hglb );
#endif
}
else
hb_retc( "" );
}
else
hb_retc( "" );
}
if( hRes )
{
hglb = LoadResource( ( HINSTANCE ) GetResources(), hRes );
if( hglb ) // && ! ( GlobalFlags( hglb ) && GMEM_DISCARDED ) )
{
hb_retclen( ( LPSTR ) LockResource( hglb ), SizeofResource( GetResources(), hRes ) );
#ifndef UNICODE
UnlockResource( hglb );
#endif
}
else
{
MessageBox( 0, "Can't load resource", "error", 0 );
hb_retc( "" );
}
}
else
{
MessageBox( 0, "Can't find resource", "error", 0 );
hb_retc( "" );
}
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Silvio.Falconi and 100 guests