473,396 Members | 2,050 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,396 software developers and data experts.

Wincore Debug assertion failed

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 this bug
immediately in my project.
The line 958 is as follows in wincore.cpp

When I am trying to close my window created CFrameWnd class by calling
DestroyWindow() this assertion has been asserted.

BOOL CWnd::DestroyWindow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);

Thanks
Mullai

Jul 17 '06 #1
4 9350
Hi,

You wouldn't normally call DestroyWindow for a CFrameWnd. Could you explain
why you are trying to do this and show us some of your code.

Cheers
Doug Forster

"Mullai" <mu*******@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
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 this bug
immediately in my project.
The line 958 is as follows in wincore.cpp

When I am trying to close my window created CFrameWnd class by calling
DestroyWindow() this assertion has been asserted.

BOOL CWnd::DestroyWindow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);

Thanks
Mullai

Jul 17 '06 #2
first of all Thanku Mr.Doug Forster for ur response.

My scenario is:

In CMainframe class , I add my own class called CChildWindow
which is derived from CScrollview. In CChildWindow I added my own class
called CPagewindow which is been derived from CFrameWnd.The place where
I get error is , While I am trying to close my main application,
CMainframe's OnClose() is called which in turn calls CChildWindow's
OnClose() where the Pagewindow->DestroyWindow() is called. Here only
the assertion occurs.

CMainframe -CChildWindow -CPageWindow -DestroyWindow()

The Code follows as:

void CMainFrame::OnClose()
{

GlobalMembers::m_PageWindowHandle=m_ChildWnd->m_structPgDetails[i].PageHandle;
m_ChildWnd->OnClose();
CFrameWnd::OnClose();

}

void CChildWindow::OnClose()
{
pagewindow->DestroyWindow();
}

///// Asserts here in destroy window
Debug Assertion Failed!
program:................
File: wincore.cpp
Line: 958
/////
Doug Forster wrote:
Hi,

You wouldn't normally call DestroyWindow for a CFrameWnd. Could you explain
why you are trying to do this and show us some of your code.

Cheers
Doug Forster

"Mullai" <mu*******@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
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 this bug
immediately in my project.
The line 958 is as follows in wincore.cpp

When I am trying to close my window created CFrameWnd class by calling
DestroyWindow() this assertion has been asserted.

BOOL CWnd::DestroyWindow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);

Thanks
Mullai
Jul 18 '06 #3
Hi,

Well I don't fully understand your window structure, but usually if they are
all parented correctly you shouldn't need to do anything special to close
child windows - the MFC infrastructure will handle it. So the first thing to
try is simply commenting out much of your closing code - the assertion is
just telling you that the window is already gone. If for some reason you DO
need to explicitly close a window then the usual way is to simply Post a
WM_CLOSE and let the infrastructure handle the rest. Usually the only
situation you need to explicitly call DestroyWindow in MFC is during the
shutdown handling of a modeless dialog.

Cheers
Doug Forster

"Mullai" <mu*******@gmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
first of all Thanku Mr.Doug Forster for ur response.

My scenario is:

In CMainframe class , I add my own class called CChildWindow
which is derived from CScrollview. In CChildWindow I added my own class
called CPagewindow which is been derived from CFrameWnd.The place where
I get error is , While I am trying to close my main application,
CMainframe's OnClose() is called which in turn calls CChildWindow's
OnClose() where the Pagewindow->DestroyWindow() is called. Here only
the assertion occurs.

CMainframe -CChildWindow -CPageWindow -DestroyWindow()

The Code follows as:

void CMainFrame::OnClose()
{

GlobalMembers::m_PageWindowHandle=m_ChildWnd->m_structPgDetails[i].PageHandle;
m_ChildWnd->OnClose();
CFrameWnd::OnClose();

}

void CChildWindow::OnClose()
{
pagewindow->DestroyWindow();
}

///// Asserts here in destroy window
Debug Assertion Failed!
program:................
File: wincore.cpp
Line: 958
/////
Doug Forster wrote:
>Hi,

You wouldn't normally call DestroyWindow for a CFrameWnd. Could you
explain
why you are trying to do this and show us some of your code.

Cheers
Doug Forster

"Mullai" <mu*******@gmail.comwrote in message
news:11**********************@m79g2000cwm.googleg roups.com...
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 this bug
immediately in my project.
The line 958 is as follows in wincore.cpp

When I am trying to close my window created CFrameWnd class by calling
DestroyWindow() this assertion has been asserted.

BOOL CWnd::DestroyWindow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);

Thanks
Mullai

Jul 18 '06 #4
Hi,

I tried by sending a window Message (WM_CLOSE) . Even then the
problem occurred. I then found out this error is because of the current
thread state. SO I added AFX_MANAGE_STATE(Afxgetappmodulestate())
before the window message. The problem is solved.

THANK U FOR YOUR KIND HELP.

REGARDS,
Mullai.P
Doug Forster wrote:
Hi,

Well I don't fully understand your window structure, but usually if they are
all parented correctly you shouldn't need to do anything special to close
child windows - the MFC infrastructure will handle it. So the first thing to
try is simply commenting out much of your closing code - the assertion is
just telling you that the window is already gone. If for some reason you DO
need to explicitly close a window then the usual way is to simply Post a
WM_CLOSE and let the infrastructure handle the rest. Usually the only
situation you need to explicitly call DestroyWindow in MFC is during the
shutdown handling of a modeless dialog.

Cheers
Doug Forster

"Mullai" <mu*******@gmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
first of all Thanku Mr.Doug Forster for ur response.

My scenario is:

In CMainframe class , I add my own class called CChildWindow
which is derived from CScrollview. In CChildWindow I added my own class
called CPagewindow which is been derived from CFrameWnd.The place where
I get error is , While I am trying to close my main application,
CMainframe's OnClose() is called which in turn calls CChildWindow's
OnClose() where the Pagewindow->DestroyWindow() is called. Here only
the assertion occurs.

CMainframe -CChildWindow -CPageWindow -DestroyWindow()

The Code follows as:

void CMainFrame::OnClose()
{

GlobalMembers::m_PageWindowHandle=m_ChildWnd->m_structPgDetails[i].PageHandle;
m_ChildWnd->OnClose();
CFrameWnd::OnClose();

}

void CChildWindow::OnClose()
{
pagewindow->DestroyWindow();
}

///// Asserts here in destroy window
Debug Assertion Failed!
program:................
File: wincore.cpp
Line: 958
/////
Doug Forster wrote:
Hi,

You wouldn't normally call DestroyWindow for a CFrameWnd. Could you
explain
why you are trying to do this and show us some of your code.

Cheers
Doug Forster

"Mullai" <mu*******@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
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 this bug
immediately in my project.
The line 958 is as follows in wincore.cpp

When I am trying to close my window created CFrameWnd class by calling
DestroyWindow() this assertion has been asserted.

BOOL CWnd::DestroyWindow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);

Thanks
Mullai
Jul 26 '06 #5

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

Similar topics

0
by: Chemix | last post by:
Hello people, I've developed a windows forms application with VC++.NET. The problem I have is the next: I run my application and all seems go OK, but passed a certain time (it can be hours or some...
2
by: SorceCode | last post by:
Hey guys, good old > Debug Assertion Failed! > File: dbgdel.cpp > Line: 47 > Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) Rears its ugly head agian! Ok heres what Im up to..
6
by: Cormac | last post by:
Hi everyone, I'm writing Pure Data externals in C++ using Ms Visual C++ 7.0 and Windows2000. I'm running motions sensor hardware so there's a bit of real time data processing involved. When...
2
by: w3r3w0lf | last post by:
hello! can anyone explain this to me? I get a "debug assertion failed" msg after some time in my prog...: file fclose.c, stream!=null thanks!
2
by: Arti Potnis | last post by:
Hi, I have an application with a function "myfunction" that opens a file and writes to it using fprintf. This application runs on a unix (sun solaris 5.8) system. I connect to this application...
4
by: ellieong | last post by:
When i try to run my program, i get this error "debug assertion failed!" and it's caused by this file called "afxtempl.h" at line 262. isn't this header file provided by c++? so how can i get rid...
0
by: lawrence | last post by:
Hi, I made a MFC ActiveX with a CwinThread Class in VC ++. Then i used it on Visual basic. When i try to make an exe i got this error : Debug Assertion Failed! Program: C:\PROGRAM...
2
by: karspy | last post by:
In my COM Server i have added Dialog Box. i have registered OCX file and added that Activex Control to my Project also. It has created 1 header file and 1 source file. After that i have created...
1
by: jerry | last post by:
i have a problem: when i run a program,it pop up a windows,title is microsoft visual c++ failed! contents are: program: ...io\myprojects\phonebook\debug\phonebook.exe file:fopen.c line:54...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.