Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 913761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:36:41+00:00 2026-05-15T17:36:41+00:00

The following code will give a hard fail when run under Windows 7 32bit:

  • 0

The following code will give a hard fail when run under Windows 7 32bit:

void CTestView::OnDraw(CDC* /*pDC*/)
{
    *(int*)0 = 0; // Crash

    CTestDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    if (!pDoc)
        return;

    // TODO: add draw code for native data here
}

However, if I try this on Windows 7 64bit, I just get this in the output window:

First-chance exception at 0x13929384
in Test.exe: 0xC0000005: Access
violation writing location 0x00000000.
First-chance exception at 0x77c6ee42
in Test.exe: 0xC0150010: The
activation context being deactivated
is not active for the current thread
of execution.

What is the reason for this? I know it’s a hardware exception (http://msdn.microsoft.com/en-us/library/aa363082.aspx), but why the difference when ran under 32bit and 64bit? And what can I do to correctly handle these kind of errors? Because they should really be trapped and fixed, as opposed to what currently happens which is Windows just carries on pumping messages to the application and let’s it run (so the user and the developers are completely unaware any problems have actually occurred).

Update:
Our regular crash reporting software uses SetUnhandledExceptionFilter but that doesn’t get called on x64 for hardware exceptions inside a WndProc. Does anyone have any information on this, or a workaround?

Update2:
I’ve reported the issue at Microsoft Connect:
https://connect.microsoft.com/VisualStudio/feedback/details/550944/hardware-exceptions-on-x64-machines-are-silently-caught-in-wndproc-messages

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:36:42+00:00Added an answer on May 15, 2026 at 5:36 pm

    OK, I’ve received a reply from Microsoft:

    Hello,

    Thanks for the report. I’ve found out
    that this is a Windows issue, and
    there is a hot fix available. Please
    see
    http://support.microsoft.com/kb/976038
    for a fix that you can install if you
    wish.

    @Skute: note that the Program
    Compatibility Assistant will ask once
    if the program should be allowed to
    continue to execute, and after that it
    will always be allowed, so that may be
    the cause of the confusing behavior
    you are seeing.

    Pat Brenner Visual C++ Libraries
    Development

    So the workaround is either make sure the hotfix is installed, or wrap each WndProc in your application with a __try / __except block.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing problem in big decimal no. Following code snippet will explain my
I got the following code: string path = Environment.CurrentDirectory; private void button1_Click(object sender, EventArgs
Where does the pointer returned by calling string::c_str() point to ? In the following
I have an application that runs with Twilio. The idea is that you will
I'm converting an algorithm from C# to C++. A small part of the algorithm
I have a strange problem by initiating a class object. The problem is as
Im having a problem with derived columns in SSIS. When in SSMS i can
With the WebForms view engine, I'll commonly use the ternary operator for very simple
Is there a way to render a html.erb partial as a one line of
I created a simple python project that serves up a couple of pages. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.