Click here to Skip to main content
15,906,097 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Delete operator Pin
led mike27-Jun-07 4:45
led mike27-Jun-07 4:45 
QuestionPrivate functions Pin
tom groezer26-Jun-07 3:30
tom groezer26-Jun-07 3:30 
AnswerRe: Private functions Pin
Cedric Moonen26-Jun-07 3:38
Cedric Moonen26-Jun-07 3:38 
AnswerRe: Private functions Pin
Roger Stoltz26-Jun-07 3:57
Roger Stoltz26-Jun-07 3:57 
QuestionInline functions Pin
tom groezer26-Jun-07 3:18
tom groezer26-Jun-07 3:18 
AnswerRe: Inline functions Pin
Rajkumar R26-Jun-07 3:27
Rajkumar R26-Jun-07 3:27 
Questionhelp to solve this bug Pin
James_Programmer26-Jun-07 3:04
James_Programmer26-Jun-07 3:04 
AnswerRe: help to solve this bug Pin
Cedric Moonen26-Jun-07 3:15
Cedric Moonen26-Jun-07 3:15 
AnswerRe: help to solve this bug Pin
Iain Clarke, Warrior Programmer26-Jun-07 3:23
Iain Clarke, Warrior Programmer26-Jun-07 3:23 
GeneralRe: help to solve this bug Pin
James_Programmer26-Jun-07 3:48
James_Programmer26-Jun-07 3:48 
GeneralRe: help to solve this bug Pin
James_Programmer26-Jun-07 3:56
James_Programmer26-Jun-07 3:56 
GeneralRe: help to solve this bug Pin
Iain Clarke, Warrior Programmer26-Jun-07 4:33
Iain Clarke, Warrior Programmer26-Jun-07 4:33 
GeneralRe: help to solve this bug Pin
James_Programmer26-Jun-07 5:00
James_Programmer26-Jun-07 5:00 
GeneralRe: help to solve this bug Pin
James_Programmer26-Jun-07 5:14
James_Programmer26-Jun-07 5:14 
GeneralRe: help to solve this bug Pin
Iain Clarke, Warrior Programmer26-Jun-07 5:47
Iain Clarke, Warrior Programmer26-Jun-07 5:47 
Um, CString doesn't have a SetFont method. Or a SetWindowText method. So your above code not only has a memory leak, it wouldn't compile. CString is just a handy holder for a bunch of characters all in a row.
I'm going to make a leap in the dark, and say you're confusing it with a Label in VB...


As for the other question...
You need to keep a copy of the font around.

class CMyDialog : public CDialog
{
public:
    CDialog (.....)
    {
        m_fMyFont.CreateSomehow ();
        .....
    }

    ....
    BOOL OnInitDialog ()
    {
        SetFont (&m_fMyFont);
        ....
        return CDialog::OnInitDialog ();
    }

    

protected:
    CFont m_fMyFont;
};


Obviously, I've removed a lot of boilerplate code. I'm assuming you have a dialog, or such. Create the font, and SetFont with a pointer to it. In the above example, the window will be destroyed, then the destructor of CMyDialog. At the end of that, the destructor for CFont will be called, tidying up the font.

Not all solutions involve pointers!


Iain.



GeneralRe: help to solve this bug Pin
James_Programmer26-Jun-07 6:01
James_Programmer26-Jun-07 6:01 
GeneralRe: help to solve this bug Pin
Mark Salsbery26-Jun-07 7:47
Mark Salsbery26-Jun-07 7:47 
Questionbrowse ... Pin
tasumisra26-Jun-07 2:33
tasumisra26-Jun-07 2:33 
AnswerRe: browse ... Pin
ahmad_ali26-Jun-07 6:45
ahmad_ali26-Jun-07 6:45 
GeneralRe: browse ... Pin
tasumisra26-Jun-07 20:52
tasumisra26-Jun-07 20:52 
GeneralRe: browse ... Pin
ahmad_ali26-Jun-07 22:55
ahmad_ali26-Jun-07 22:55 
QuestionData Types Pin
tasumisra26-Jun-07 1:34
tasumisra26-Jun-07 1:34 
AnswerRe: Data Types Pin
aatul26-Jun-07 1:41
aatul26-Jun-07 1:41 
AnswerRe: Data Types Pin
KarstenK26-Jun-07 3:27
mveKarstenK26-Jun-07 3:27 
QuestionEncode using DirectShow Pin
Maynka26-Jun-07 0:58
Maynka26-Jun-07 0:58 

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.