473,770 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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::DestroyWi ndow()
{
if (m_hWnd == NULL)
return FALSE;

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

Thanks
Mullai

Jul 17 '06 #1
4 9421
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*******@gmai l.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.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::DestroyWi ndow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanen t(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::OnC lose()
{

GlobalMembers:: m_PageWindowHan dle=m_ChildWnd->m_structPgDeta ils[i].PageHandle;
m_ChildWnd->OnClose();
CFrameWnd::OnCl ose();

}

void CChildWindow::O nClose()
{
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*******@gmai l.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.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::DestroyWi ndow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanen t(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*******@gmai l.comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.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::OnC lose()
{

GlobalMembers:: m_PageWindowHan dle=m_ChildWnd->m_structPgDeta ils[i].PageHandle;
m_ChildWnd->OnClose();
CFrameWnd::OnCl ose();

}

void CChildWindow::O nClose()
{
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*******@gmai l.comwrote in message
news:11******* *************** @m79g2000cwm.go oglegroups.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::DestroyWi ndow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanen t(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_STAT E(Afxgetappmodu lestate())
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*******@gmai l.comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.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::OnC lose()
{

GlobalMembers:: m_PageWindowHan dle=m_ChildWnd->m_structPgDeta ils[i].PageHandle;
m_ChildWnd->OnClose();
CFrameWnd::OnCl ose();

}

void CChildWindow::O nClose()
{
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*******@gmai l.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.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::DestroyWi ndow()
{
if (m_hWnd == NULL)
return FALSE;

CHandleMap* pMap = afxMapHWND(); ///// line 958/////
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanen t(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
2030
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 minutes), then a dialog window opens with the title:Microsoft Visual C++ Debug Library, and the next error: Debug Assertion Failed! Program: name of my program File: dbgheap.c Line: 1132 Expression: _CrtIsValidHeadPointer(pUserData)
2
3918
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
595
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 I'm running my objects in Pure Data, I get an assertion failure after a few seconds of running the motion sensors and I can't seem to get rid of it. The error occurs in the expression _CrtCheckMemory(). Could anyone provide some possible solutions?
2
3911
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
17623
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 from a VB GUi on a windows 2000 system. The GUI invokes "myfunction". I get the following error:-
4
13570
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 of this problem. if i click ignore i can see the output, but how can i get rid of such an error msg?
0
2961
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 FILES\MICROSOFT VISUAL STUDIO\VB98\VB6.EXE File: cmdtarg.cpp Line: 52
2
13053
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 an instance(object) of that ActiveX control and trying to call functions, But its giving run time error. Debug Assertion Filed! File: winocc.cpp Line: 345
1
5809
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 expression: *file !=_T('\0') for information on how your program can cause an assertion failure,see the visual c++ doucmention on asserts.
0
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10057
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10002
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9869
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.