Include file TXT within a file RC (Resource)

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

edk
Posts: 103
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 24 times
Been thanked: 44 times

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

Post by edk » Fri Apr 21, 2017 10:10 am

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: 924
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 89 times
Been thanked: 25 times

Post by bpd2000 » Fri Apr 21, 2017 10:56 am

BPD
HMG Convert Dream into Reality

User avatar
Rathinagiri
Posts: 5096
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 93 times
Been thanked: 106 times
Contact:

Post by Rathinagiri » Fri Apr 21, 2017 2:46 pm

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


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest