Article View: borland.public.cppbuilder.nativeapi
Article #8428Re: Load font from resource
From: PaoloItaly
Date: Thu, 21 Oct 2004 06:49
Date: Thu, 21 Oct 2004 06:49
33 lines
1825 bytes
1825 bytes
Follow the unique solution i found at the moment
MainForm constructor:
HRSRC h = ::FindResource(NULL, "LADDERFONT", "RT_FONT");
HGLOBAL hg;
if (h)
{
long size = ::SizeofResource(NULL, h);
if (size > 0)
{
hg = ::LoadResource(NULL, h);
if (hg)
{
void *p = ::LockResource(hg);
if (p)
{
HANDLE h = _creat("LDDFNT.TTF", 0);
if (h != INVALID_HANDLE_VALUE)
{
_write(h, p, size);
_close(h);
::AddFontResource("LDDFNT.TTF");
}
}
}
}
}
MainForm destructor
if (access("LDDFNT.TTF", 0) == 0)
{
::RemoveFontResource("LDDFNT.TTF");
remove("LDDFNT.TTF");
}
Technical Details
Message-ID:
<41775c18$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.wirehub.nl!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!195.5.65.34.MISMATCH!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4176068a$1@newsgroups.borland.com> <6padn0lpe0t995pn2375f26pb7sh4bp2d5@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,15bb0ddfaf3b41c0 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "PaoloItaly" <paolot@FAKETHESPAMMERsirius-es.it> Newsgroups: borland.public.cppbuilder.nativeapi References: <4176068a$1@newsgroups.borland.com> <6padn0lpe0t995pn2375f26pb7sh4bp2d5@4ax.com> Subject: Re: Load font from resource Date: Thu, 21 Oct 2004 08:49:38 +0200 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 82.105.234.125 Message-ID: <41775c18$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1098341400 82.105.234.125 (20 Oct 2004 23:50:00 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.wirehub.nl!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!195.5.65.34.MISMATCH!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail