Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / December 2004

Tip: Looking for answers? Try searching our database.

Debugger Error in VC++.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ziv - 14 Dec 2004 10:52 GMT
I am encountering a very strange error
Openning a Visual C++/Win32 Console project with mfc support, writing a simple Sleep(5000) function in the main and running the app in Debug mode (default settings). while closing the app in the middle of execution (click on the close window button) i am getting the following error
"Unhandled exception at 0x7c29ed41 (mfc71d.dll) in test2.exe: 0xC0000005: Access violation reading location 0xf78b78e8.

This behavior occurs only in debug mode configuration

We are encountering many problems in porting our code from VC6 to VC++.NET but we would like to solve this first..

Running Visual Studio.NET 7.1.3088, .NET Framework 1.1.4322 SP1, on Windows2000 Professional, SP

thanks in advance, ziv
Oleg Starodumov - 15 Dec 2004 09:39 GMT
> I am encountering a very strange error:
> Openning a Visual C++/Win32 Console project with mfc support, writing a simple Sleep(5000) function in the main and running the app in Debug mode (default settings). while closing the app in the middle of execution (click on the close
window button) i am getting the following error:
> "Unhandled exception at 0x7c29ed41 (mfc71d.dll) in test2.exe: 0xC0000005: Access violation reading location 0xf78b78e8."
>
[quoted text clipped - 3 lines]
>
> Running Visual Studio.NET 7.1.3088, .NET Framework 1.1.4322 SP1, on Windows2000 Professional, SP4

When you click Close button, the default handler for the event calls ExitProcess,
thus triggering MFC cleanup. The problem is that the system starts a new thread
to call the handler, and therefore the cleanup is made on that thread, not on
the main thread (which is killed by ExitProcess by that time).

The solution is to register your own handler for Close, Ctrl-C and Ctrl-Break events
(using SetConsoleCtrlHandler function), handle these events and ask your main thread
to exit cleanly.

Regards,
Oleg

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.