?
Solved

Destroying a Window Question

Posted on 2003-03-13
4
Medium Priority
?
187 Views
Last Modified: 2010-04-01
Hi:

If I do this, how do I destroy the Window? THe following does not work, obviously. I need to somehow destroy the main window.

////////////////////////////////////////////////////////////////////////////
// Define a window class derived from CFrameWnd
class CConsleWindow : public CFrameWnd
{
public:
     CConsleWindow()
          { Create(NULL, _T("Console"), WS_OVERLAPPEDWINDOW, rectDefault); }
};

/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
// CconsoleApp initialization

BOOL CconsoleApp::InitInstance()
{

m_pMainWnd = new CConsleWindow();

}


On logout (When a user logs out):

DestroyWindow(m_pMainWnd);  //I am trying to destroy the window here

I tried Cwnd::DestroyWindow(); but, this is not it either...

Please help.

Thanks,
Doug

0
Comment
Question by:DougC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Author Comment

by:DougC
ID: 8130567
Actually, I want to get rid of the instance of CconsoleApp.
Any ideas?

Thanks,
Doug
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 8131812


If it's not :m_pMainWnd->DestroyWindow()", then check the CFrameWnd class for a Close() or Destroy() method.


0
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 80 total points
ID: 8131817
That should be:

 m_pMainWnd->DestroyWindow()
0
 
LVL 1

Author Comment

by:DougC
ID: 8132098
Works like a champ!! Thanks!!!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question