Hi all,

I'm developing an application which helps to manage car park by recognizing the car's plate number. I use VC++, OpenCV, Windows SDK and DirectX in this app. But I'm now having a little trouble with it.

Let me introduce a bit about how my system works so that you guys can understand about it:

When a car enters the park, we scan one card with a card reader. Right after the card is read, our camera will take a picture of the car's plate and our system will recognize the plate number and assign it to the scanned card's id. And the car will then be allowed to get into the park.

When the car gets out of the park, the same process happens. If the plate number of the car and the card's id are the same with those in database, the car will be allowed to get out.

Here is my trouble: When I start the application, it works fine and no errors happen like the below picture.

http://s1.postimage.org/266bl4fsy/image.jpg

But the "Debug assertion failed" error happen when I scan a card with our card reader. The specific error is in the below image.
http://s2.postimage.org/270yeip2a/image.jpg

Can any one help me to fix this annoying error? :( Many thanks to you all.

Recommended Answers

All 8 Replies

Hi, the error message states where the problem is. You must go to the WinCore.cpp file at line 906. From there you should be able to back-trace where the problem is actually stemming from.

EDIT: This is an assert failure. So the line should look something like ASSERT(<some equality statement>);

Basically, if the equality of the ASSERT statement is false, it will throw that exception that you can see.

Hi, the error message states where the problem is. You must go to the WinCore.cpp file at line 906. From there you should be able to back-trace where the problem is actually stemming from.
.

Hi Ketsuekiame,

The line 906 in Wincore.cpp is below

903:    if(pMap)
904:    {
905:        ASSERT( (p = pMap->LookupPermanent(m_hWnd)) != NULL ||
906:            (p = pMap->LookupTemporary(m_hWnd)) != NULL);
907:    }
908:    ASSERT((CWnd*)p == this);

Thanks for your suggestion. I looked at this file before, it is in the folder "C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc\" and I don't think that there's any error with this file because it's the file of Visual studio which I didn't write it. In your opinion, is there any other things which might generate this error? Like some mistakes when configuring the environment with DirectX, or Windows SDK, or anything like that?

Thank you again.

No, there won't be an error with this file, I agree. However, you need to backtrace what is calling this code.

For example, losing the device context or the window handle may cause it. There may be a missing instance on a control...An event might not be set up properly etc etc.

You need to insert strategic breakpoints in your code. When you perform the action which causes the crash, find the start of the code for that action, insert a breakpoint and follow the code through. Usually it will be a few methods before the assert which will start a call chain and eventually cause the crash.

Debugging can be a long and tedious process, especially when the exceptions are being thrown inside windows libraries.

It's unlikely to be a mistake in installing and configuring the SDK, otherwise you wouldn't be able to build it.

No, there won't be an error with this file, I agree. However, you need to backtrace what is calling this code.

For example, losing the device context or the window handle may cause it. There may be a missing instance on a control...An event might not be set up properly etc etc.

You need to insert strategic breakpoints in your code. When you perform the action which causes the crash, find the start of the code for that action, insert a breakpoint and follow the code through. Usually it will be a few methods before the assert which will start a call chain and eventually cause the crash.

Debugging can be a long and tedious process, especially when the exceptions are being thrown inside windows libraries.

It's unlikely to be a mistake in installing and configuring the SDK, otherwise you wouldn't be able to build it.

Actually I am responsible for maintaining this project. The project works ok with the previous developer. I just received this project from him. That's why I think there's something wrong in the configuration process, not the source code. Do you think that the application can run like this if I mis-configured the environment? The technologies used are OpenCV, DirectX and WindowsSDK.

Thanks a lot.

I have never used OpenCV so I'm afraid I can't be much use there. As for DirectX and Windows SDK, once you link in the libraries they're pretty well coded into the OS, if it builds, you're almost guaranteed that it's not them. It's more likely a change that has been made somewhere in the code, perhaps a resource is missing?

If you're getting the error on a machine other than your development machine, but it works fine on your development machine, then you may be right, in that required libraries may be missing.

I have never used OpenCV so I'm afraid I can't be much use there. As for DirectX and Windows SDK, once you link in the libraries they're pretty well coded into the OS, if it builds, you're almost guaranteed that it's not them. It's more likely a change that has been made somewhere in the code, perhaps a resource is missing?

If you're getting the error on a machine other than your development machine, but it works fine on your development machine, then you may be right, in that required libraries may be missing.

Thanks Ketsuekiame very much for your help :-)

No problem! If you find the solution, please come back and post it. It helps for future reference in case it happens again =)

No problem! If you find the solution, please come back and post it. It helps for future reference in case it happens again =)

Sure I will, Ket.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.