Memory leak while running a dialog that is derived from CAxDialogImpl

15 pts.
Tags:
DialogBox
Open Dialog
VC Programs
VC++
Hello,
I have taken a MFC dialog application. I derived a class called CMyDialog from CAxDialogImpl. I created an object of CMyDialog and called DoModal(); The application runs but i found a memory leak.
I learnt that the memory allocated by HeapAlloc is not freed. Where do i free this? Please help me.
Sumee


Software/Hardware used:
Windows

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    Can you post your code ? Also, how did you determine that the memory is not being freed ?
    69,510 pointsBadges:
    report
  • ShilpaSatavalli
    Thank you for the reply. I run Visual leak detector to check the memory leaks. The trace pointed me to the DoModal of the dialog box. My sample has no code added to the generated one. Here is the sample code: class Cdedede : public CAxDialogImpl<Cdedede> { public: Cdedede() { } ~Cdedede() { } enum { IDD = IDD_DEDEDE }; BEGIN_MSG_MAP(Cdedede) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK) COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnClickedCancel) CHAIN_MSG_MAP(CAxDialogImpl<Cdedede>) END_MSG_MAP() // Handler prototypes: // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CAxDialogImpl<Cdedede>::OnInitDialog(uMsg, wParam, lParam, bHandled); bHandled = TRUE; return 1; // Let the system set the focus } LRESULT OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { EndDialog(wID); return 0; } LRESULT OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { EndDialog(wID); return 0; } };
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following