Include file TXT within a file RC (Resource)

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

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

Post 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.
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

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

Post by bpd2000 »

BPD
Convert Dream into Reality through HMG
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

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

Post by Rathinagiri »

Wonderful! Thanks a lot!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply