Exemplo:
Leiame RCDATA texto.txt
Bom, minha dúvida é depois como usar este arquivo dentro do meu programa?
Abraços,

Moderador: Moderadores
Leiame RCDATA texto.txt
#Include <hmg.ch>
Function Main()
Local cFileRes:=ResToFile("README")
MsgInfo(cFileRes)
Return Nil
#pragma BEGINDUMP
#include <Windows.h>
#include <hbApi.h>
HB_FUNC( RESTOFILE )
{
static HRSRC hr;
static HGLOBAL hg;
hr = FindResource( NULL, (LPSTR) hb_parc( 1 ), RT_RCDATA );
if( ! ( hr == 0 ) )
{
hg = LoadResource( NULL, hr );
if( ! ( hg == 0 ) )
{
char *lpRcData=( char *)LockResource( hg );
hb_retc( lpRcData );
}
}
}
#pragma ENDDUMP
// HMG_LoadResourceRawFile ( cFileName, cTypeResource | nTypeResourceID )
HB_FUNC ( HMG_LOADRESOURCERAWFILE )
{
HRSRC hResourceData;
HGLOBAL hGlobalResource;
LPVOID lpGlobalResource = NULL;
DWORD nFileSize;
TCHAR *FileName = (TCHAR*) HMG_parc(1);
TCHAR *TypeResource = HB_ISCHAR (2) ? (TCHAR*) HMG_parc(2) : MAKEINTRESOURCE ( hb_parni(2) );
hResourceData = FindResource ( NULL, FileName, TypeResource );
if ( hResourceData != NULL )
{
hGlobalResource = LoadResource ( NULL, hResourceData );
if ( hGlobalResource != NULL )
{
lpGlobalResource = LockResource ( hGlobalResource );
if ( lpGlobalResource != NULL )
{
nFileSize = SizeofResource ( NULL, hResourceData );
hb_retclen ( (const CHAR *) lpGlobalResource, (HB_SIZE) nFileSize );
}
FreeResource ( hGlobalResource );
}
}
if ( lpGlobalResource == NULL )
hb_retclen ( (const CHAR *) NULL, (HB_SIZE) 0 );
}
/****************************************************************************
HMG_LoadResourceRawFile ( cFileName, cTypeResource | nTypeResourceID ) *
*****************************************************************************/
// Standard resource type ID ( constant defined in i_controlmisc.ch )
#define RT_CURSOR (1)
#define RT_FONT (8)
#define RT_BITMAP (2)
#define RT_ICON (3)
#define RT_MENU (4)
#define RT_DIALOG (5)
#define RT_STRING (6)
#define RT_FONTDIR (7)
#define RT_ACCELERATOR (9)
#define RT_RCDATA (10)
#define RT_MESSAGETABLE (11)
#define DIFFERENCE (11)
#define RT_GROUP_CURSOR ( RT_CURSOR + DIFFERENCE )
#define RT_GROUP_ICON ( RT_ICON + DIFFERENCE )
#define RT_VERSION (16)
#define RT_DLGINCLUDE (17)
#define RT_PLUGPLAY (19)
#define RT_VXD (20)
#define RT_ANICURSOR (21)
#define RT_ANIICON (22)
#define RT_HTML (23)
#define RT_MANIFEST (24)
Function Main
cData1 := HMG_LoadResourceRawFile ( "File1", RT_RCDATA )
cData2 := HMG_LoadResourceRawFile ( "File2", "TXT" )
Return Nil
File1 RCDATA texto.txt
File2 TXT texto.txt
Usuários vendo este fórum: Nenhum usuário registrado online e 6 visitantes