 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
ShurikeN Advanced Cheater
Reputation: 0
Joined: 09 Jan 2008 Posts: 84
|
Posted: Sat Jan 17, 2009 7:12 am Post subject: [C++] Help Loading Font |
|
|
how can i load and use font from the resource file (.rc) ?
_________________
| Code: | XXXXXX XXXXXX
XXXXX XXXXX
XXXXXXXX
D I R E C T
XXXXXXXX
XXXXX XXXXX
XXXXXX XXXXXX
GameDev
|
|
|
| Back to top |
|
 |
aquaboy007 Expert Cheater
Reputation: 0
Joined: 14 May 2006 Posts: 199
|
Posted: Sat Jan 17, 2009 7:39 am Post subject: |
|
|
There are 2 threads in search n destroy forums about this... I'll tell you what I do anyway...
you need to first get the logfont structure of the font you need. Read here:
http://www.codeguru.com/cpp/g-m/gdi/fonthandlinganddetection/article.php/c155
then add the font to your resource file. just like an icon. the type is "FONT" and the id is 8 i think... its on MSDN.
then findresource, loadresource, lockresource. then use addfontmemresourceex and createfont(using the logfont details you got previously)
then you have to set the font for all controls, which are all windows themselves. so you need to use enumchildwindows using a proc, inside which you sendmessage WM_SETFONT.
here are some samples...
resource file...
| Code: |
IDR_FONT1 FONT "visitor2.ttf"
|
resource header...
| Code: |
#define IDR_FONT1 103
|
wm_initdialog
| Code: |
hRes = FindResource(hInst, MAKEINTRESOURCE(103), RT_FONT);
hResLoad = (HRSRC)LoadResource(hInst,hRes);
lpResLock = (char *)LockResource(hResLoad);
AddFontMemResourceEx(lpResLock,SizeofResource(NULL,hRes),0,&nbfonts);
hFont=CreateFont(-13,0,0,0,400,0,0,0,0,3,2,5,2,TEXT("Visitor TT2 BRK"));
EnumChildWindows( hWndDlg, (WNDENUMPROC) EnumChildProc, NULL);
|
finally enumchildproc
| Code: | | SendMessage( hwnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM( true, 0 ) ); |
_________________
| x0r wrote: | So now there are versions which come with a certain level of BSODs?
DAEngine PREMIUM - Now with 20% less BSODs! |
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Jan 17, 2009 9:35 pm Post subject: |
|
|
If he CreateFonts before the WM_CREATE message is processed, or the window is loaded at all i should say, won't it automatically set the font to his font?
_________________
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|