Click here to Skip to main content
15,917,565 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sharing a structure between a console application and a static library Pin
Munchies_Matt19-Apr-17 5:18
Munchies_Matt19-Apr-17 5:18 
GeneralRe: Sharing a structure between a console application and a static library Pin
Chris Losinger19-Apr-17 5:22
professionalChris Losinger19-Apr-17 5:22 
GeneralRe: Sharing a structure between a console application and a static library Pin
Munchies_Matt19-Apr-17 5:38
Munchies_Matt19-Apr-17 5:38 
GeneralRe: Sharing a structure between a console application and a static library Pin
Chris Losinger19-Apr-17 5:45
professionalChris Losinger19-Apr-17 5:45 
QuestionCDateTimeCtrl in Windows 10 Pin
Member 1313216716-Apr-17 19:24
Member 1313216716-Apr-17 19:24 
SuggestionRe: CDateTimeCtrl in Windows 10 Pin
Richard MacCutchan16-Apr-17 21:35
mveRichard MacCutchan16-Apr-17 21:35 
QuestionRe: CDateTimeCtrl in Windows 10 Pin
David Crow17-Apr-17 3:54
David Crow17-Apr-17 3:54 
AnswerRe: CDateTimeCtrl in Windows 10 Pin
leon de boer17-Apr-17 17:41
leon de boer17-Apr-17 17:41 
Windows 10 update has a new garbage collector. You used to get away with stuff you can't anymore. For a font to be set, it must remain in memory, it can not be a variable font (like on the local stack) that is destroyed directly after setting it. Old code used to work because the old garbage collector was terrible, try it now and your font will be gone bye bye.

The telltale giveaway you did it all wrong is I bet you never deleted the CFONT you made even though you are supposed to and it's your responsibility. The reason you won't have is because when you close the class/dialog or window you no longer have access to the CFONT because it was just some local variable on the stack. Such code is not only bugged it bleeds font handles but "it did used to work".

So lets ask that question does your code delete the Cfont you made? Smile | :)

To make sure your Cfont is valid for the life of it's use, you have 3 options

1.) Place it up in the class, dialog or window data that the font is being used for
2.) Make it a global variable or do a globalalloc
3.) Use SelectObject to put it on a DC that persists for the time you need it

Finally it is your responsibility to clean up and dispose the font when your class/dialog or windows or use of it ends ... you know something like font.DeleteObject();

Basically if this is the problem your old code was always bugged you were just lucky the bug didn't shake out before because the old windows GC was horrible.
In vino veritas


modified 18-Apr-17 0:28am.

GeneralRe: CDateTimeCtrl in Windows 10 Pin
Member 150124918-Apr-17 21:37
Member 150124918-Apr-17 21:37 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
leon de boer19-Apr-17 9:56
leon de boer19-Apr-17 9:56 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
Member 150124920-Apr-17 20:41
Member 150124920-Apr-17 20:41 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
Member 150124920-Apr-17 21:14
Member 150124920-Apr-17 21:14 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
leon de boer22-Apr-17 19:17
leon de boer22-Apr-17 19:17 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
Member 150124927-Apr-17 23:01
Member 150124927-Apr-17 23:01 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
leon de boer28-Apr-17 14:57
leon de boer28-Apr-17 14:57 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
Member 150124913-Jun-17 23:06
Member 150124913-Jun-17 23:06 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
Michael E. Jones20-Apr-17 1:02
Michael E. Jones20-Apr-17 1:02 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
leon de boer20-Apr-17 7:42
leon de boer20-Apr-17 7:42 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
Richard MacCutchan20-Apr-17 22:34
mveRichard MacCutchan20-Apr-17 22:34 
PraiseRe: CDateTimeCtrl in Windows 10 Pin
JamesA_Dev25-Apr-17 4:34
JamesA_Dev25-Apr-17 4:34 
GeneralRe: CDateTimeCtrl in Windows 10 Pin
UrbanBlues4-May-17 9:37
UrbanBlues4-May-17 9:37 
AnswerRe: CDateTimeCtrl in Windows 10 Pin
JamesA_Dev25-Apr-17 21:58
JamesA_Dev25-Apr-17 21:58 
AnswerRe: CDateTimeCtrl in Windows 10 Pin
JamesA_Dev13-Jun-17 23:02
JamesA_Dev13-Jun-17 23:02 
QuestionSetting compiler name in win32.mak Pin
ForNow16-Apr-17 11:20
ForNow16-Apr-17 11:20 
AnswerRe: Setting compiler name in win32.mak Pin
Richard MacCutchan16-Apr-17 21:33
mveRichard MacCutchan16-Apr-17 21:33 

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.