473,375 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,375 software developers and data experts.

What happen if delete a CWnd without calling CWnd::DestroyWindow()

After performing the following steps, what happen to my application or the
system:
1. My application has a class, namely CMyWnd, which is inherited from CWnd.
2. Instantiate a CMyWnd object by: CMyWnd* pMyWnd = new CMyWnd(...).
3. Call pMyWnd->CreateEx(...) to create the window.
4. (**DO NOT perform this step** Call pMyWnd->DestroyWindow() to destroy the
window.)
5. Release the CMyWnd object by: delete pMyWnd;

Please be note the destructor of CMyWnd does not called DestroyWindow() .
Here is declaration of the CMyWnd
class CMyWnd : public CWnd
{
CMyWnd()
{
}

~CMyWnd()
{
// do nothing
}
}
Nov 17 '05 #1
1 3928
"lauch2" <la****@discussions.microsoft.com> wrote in message
news:29**********************************@microsof t.com...
After performing the following steps, what happen to my application or the
system:
1. My application has a class, namely CMyWnd, which is inherited from CWnd. 2. Instantiate a CMyWnd object by: CMyWnd* pMyWnd = new CMyWnd(...).
3. Call pMyWnd->CreateEx(...) to create the window.
4. (**DO NOT perform this step** Call pMyWnd->DestroyWindow() to destroy the window.)
5. Release the CMyWnd object by: delete pMyWnd;

Please be note the destructor of CMyWnd does not called DestroyWindow() .
Here is declaration of the CMyWnd
class CMyWnd : public CWnd
{
CMyWnd()
{
}

~CMyWnd()
{
// do nothing
}
}


CWnd::~CWnd does call DestroyWindow -- if it needs doing, and outputs a
debug warning that OnDestroy and PostNcDestroy will not be called.
--
Jeff Partch [VC++ MVP]
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joseph | last post by:
I read a piece of code, and the code looks like the following part. CWnd is a MFC class class CFrameGrabber : public CWnd { .... }; BOOL CFrameGrabber::Create(int x, int y, CWnd...
2
by: Cantankerous Old Git | last post by:
I am trying to write a program that I hope to get working as a command-line app to start with, and then eventually use a windows service wrapper to call it as a service. Its purpose is to attach...
1
by: Rajko | last post by:
Strange, very strange. I'm using CDialog to process messages form CMenu. CDialog does not enter modal state. CDialog constructor have Create() and CDialog destructor have CWnd::DestroyWindow();...
1
by: Berrywong | last post by:
I creat a view in MyDlg using m_pview=new MyView(); I am not sure where I should delete m_pview. I called destroywindow in MyView and MyDlg, I have tried to delete m_pview in destructor of...
1
by: lauch2 | last post by:
hi, I have CView inherited class. After creating the window, I call SetTimer( , , NULL) to set a periodical timer. When the window is no longer need, I just call DestroyWindow() to destroy the...
4
by: jake | last post by:
Hello, I have an application that calls another application. Depending on what the user selects from application 2 I would like to kill application 1. How can I accomplish this? Thanks in...
3
by: blackbolek | last post by:
Hi, I have to find an error in application, but my knowledge is probably too small to do that. The problem is that I cannot debug it because of nature of error. The problem is that application...
0
by: Sudha | last post by:
Hi All, Sorry for posting again. Before i posed in different newsgroup. Dont whether thats correct news group. So posting it here: I am new to C# thread programming. I got one issue. I...
4
by: Mullai | last post by:
Hi , My program gives an error message like this Debug Assertion Failed! program:................ File: wincore.cpp Line: 958 Please can anyone help me out in this issue. I have to solve...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.