Click here to Skip to main content
15,913,055 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: passing parameter in thread Pin
James R. Twine27-Feb-07 1:24
James R. Twine27-Feb-07 1:24 
AnswerRe: passing parameter in thread Pin
James R. Twine27-Feb-07 1:29
James R. Twine27-Feb-07 1:29 
GeneralRe: passing parameter in thread Pin
neha.agarwal2727-Feb-07 1:47
neha.agarwal2727-Feb-07 1:47 
GeneralRe: passing parameter in thread Pin
James R. Twine27-Feb-07 2:46
James R. Twine27-Feb-07 2:46 
GeneralRe: passing parameter in thread Pin
neha.agarwal2727-Feb-07 19:01
neha.agarwal2727-Feb-07 19:01 
GeneralRe: passing parameter in thread Pin
James R. Twine28-Feb-07 17:11
James R. Twine28-Feb-07 17:11 
QuestionStrange Font bolding Pin
super_ttd26-Feb-07 22:15
super_ttd26-Feb-07 22:15 
AnswerRe: Strange Font bolding Pin
Nibu babu thomas26-Feb-07 23:57
Nibu babu thomas26-Feb-07 23:57 
super_ttd wrote:
CFont nf; nf.CreateFont(tm.tmHeight, tm.tmAveCharWidth, 0, 0, tm.tmWeight, FALSE, tm.tmUnderlined, tm.tmStruckOut, tm.tmCharSet, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, tm.tmPitchAndFamily, pszFontName);


You are creating a local CFont object. Hence the CFont object get's destroyed. This is the reason for this wierd behavior, might be since the font object got destroyed it's using DEFAULT_GUI_FONT.Unsure | :~

From MSDN:

Specifically, do not destroy the specified CFont object until after the CWnd control has been destroyed. 
Windows does not copy the font specified in a SetFont() call. 
If the font is destroyed before the control is destroyed, unpredictable results can occur.
"new" the font object and see the difference...

And by the way you don't have to write this much code for modifying an existing font object...

Here is the code snippet that does this...

CFont* pFont = m_cstc.GetFont();
LOGFONT lfLogFont = { 0 };
pFont->GetLogFont( &lfLogFont );
lfLogFont.lfWeight = FW_BOLD;
 
CFont pNewFont = new CFont;// Delete this afterwards, or make this a member variable
pNewFont->CreateFontIndirect( &lfLogFont );
m_cstc.SetFont( pNewFont );



Nibu thomas
A Developer

Programming tips[^]  My site[^]

AnswerRe: Strange Font bolding Pin
David Crow27-Feb-07 2:56
David Crow27-Feb-07 2:56 
GeneralRe: Strange Font bolding Pin
super_ttd27-Feb-07 3:04
super_ttd27-Feb-07 3:04 
JokeRe: Strange Font bolding Pin
Nibu babu thomas27-Feb-07 3:38
Nibu babu thomas27-Feb-07 3:38 
Questionsetting of properties for a ocx control Pin
zareee26-Feb-07 21:33
zareee26-Feb-07 21:33 
QuestionHow to Calculate no of timers. Pin
birajendu26-Feb-07 21:13
birajendu26-Feb-07 21:13 
AnswerRe: How to Calculate no of timers. Pin
David Crow27-Feb-07 2:57
David Crow27-Feb-07 2:57 
Questionmultiple c files in visual studio 6 project Pin
Ayman Mashal26-Feb-07 20:08
Ayman Mashal26-Feb-07 20:08 
AnswerRe: multiple c files in visual studio 6 project Pin
Cedric Moonen26-Feb-07 20:23
Cedric Moonen26-Feb-07 20:23 
AnswerRe: multiple c files in visual studio 6 project Pin
Rajesh R Subramanian26-Feb-07 20:24
professionalRajesh R Subramanian26-Feb-07 20:24 
QuestionRe: multiple c files in visual studio 6 project Pin
Ayman Mashal26-Feb-07 21:08
Ayman Mashal26-Feb-07 21:08 
AnswerRe: multiple c files in visual studio 6 project Pin
Cedric Moonen26-Feb-07 21:17
Cedric Moonen26-Feb-07 21:17 
GeneralRe: multiple c files in visual studio 6 project Pin
ensger27-Feb-07 0:04
ensger27-Feb-07 0:04 
AnswerRe: multiple c files in visual studio 6 project Pin
prasad_som27-Feb-07 1:34
prasad_som27-Feb-07 1:34 
AnswerRe: multiple c files in visual studio 6 project Pin
toxcct26-Feb-07 23:15
toxcct26-Feb-07 23:15 
AnswerRe: multiple c files in visual studio 6 project Pin
David Crow27-Feb-07 3:00
David Crow27-Feb-07 3:00 
QuestionCustom Menu Pin
Nishad S26-Feb-07 19:44
Nishad S26-Feb-07 19:44 
AnswerRe: Custom Menu Pin
prasad_som26-Feb-07 20:04
prasad_som26-Feb-07 20:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.