Page 2 of 2

Re: Include file TXT within a file RC (Resource)

Posted: Fri Apr 21, 2017 10:10 am
by edk
Anand wrote: Fri Apr 21, 2017 10:01 am One query, can't we just add the .ttf file directly in .rc file ? We can add .png, .html etc. I found.
Regards,
Anand
Of course you can add ttf directly:
edk wrote: Fri Apr 21, 2017 9:09 am Or without .zip:

.RC file:

Code: Select all

segoeuil   RCDATA res\segoeuil.ttf
.PRG file:

Code: Select all

IF !FILE('segoeuil.ttf')
	STRFILE(HMG_LoadResourceRawFile ( 'segoeuil', RT_RCDATA ),'segoeuil.ttf')
ENDIF

(...)

cfnt:='segoeuil.ttf'
AddFont(cfnt)
SET FONT TO "Segoe UI Light", 13

(...)

//on release of program
RemoveFont(cfnt)


*---------------------------------* 
 FUNCTION AddFont(font)
*---------------------------------* 
   #define FR_PRIVATE 0x10
   #define FR_NOT_ENUM 0x20
   local nRet :=WAPI_ADDFONTRESOURCEEX(font, FR_PRIVATE+ FR_NOT_ENUM,0)
   RETURN nRet
*---------------------------------*   
 FUNCTION RemoveFont(font)
*---------------------------------*
   #define FR_PRIVATE 0x10
   #define FR_NOT_ENUM 0x20
   local nRet := WAPI_REMOVEFONTRESOURCEEX(font, FR_PRIVATE+ FR_NOT_ENUM,0)
   RETURN nRet
****************************
I used Zip to make the .exe file have a smaller size.

Re: Include file TXT within a file RC (Resource)

Posted: Fri Apr 21, 2017 10:56 am
by bpd2000

Re: Include file TXT within a file RC (Resource)

Posted: Fri Apr 21, 2017 2:46 pm
by Rathinagiri
Wonderful! Thanks a lot!

Re: Include file TXT within a file RC (Resource)

Posted: Sat Apr 22, 2017 6:19 am
by mol
Great, thank you Edward!