title: Access violation exception in 64bit MFC version
body: <p>I am trying to port a 32bit application to 64 bit. The calculations appear to run correctly, but I cannot configure the views properly. I am using MFC, C++ and OpenGL, Intel 10.0.027 compiler inside VS2005 on a W7 x64 machine.</p>
  
  <p>When the crash happens, I get the following message: "First-chance exception at 0xffffffff8043b1b6 in 3DApp.exe: 0xC0000005: Access violation at location 0xffffffff8043b1b6" and this is the stack trace:</p>
  
  <pre><code>ffffffff8043b1b6()  
  user32.dll!UserCallWinProcCheckWow()  + 0x11d bytes 
  user32.dll!DispatchMessageWorker()  + 0x12a bytes   
  3DApp.exe!AfxInternalPumpMessage()  Line 183    C++
  3DApp.exe!CWinThread::PumpMessage()  Line 896   C++
  3DApp.exe!CWinThread::Run()  Line 625 + 0x13 bytes  C++
  </code></pre>
  
  <p><strong>NOTE PLEASE</strong> why is UserCallWinProcCheckWow called, I thought Wow suffix was only for emulating 32 bit applications on 64 bit computer</p>
  
  <p>Obviously, somewhere a 64 bit pointer gets treated as a 32 bit pointer, but I cannot pin point where that happens. I loaded debug symbols from microsoft, which show the top of the call stack.</p>
  
  <p>Any help greatly appreciated.
  Leon</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The code calling DispatchMessage is:</p>
  
  <pre><code>    if (pState-&gt;m_msgCur.message != WM_KICKIDLE &amp;&amp; !AfxPreTranslateMessage(&amp;(pState-&gt;m_msgCur)))
  {
      ::TranslateMessage(&amp;(pState-&gt;m_msgCur));
      ::DispatchMessage(&amp;(pState-&gt;m_msgCur));
  }
  </code></pre>
  
  <p>The pointers of pState appear to be 64 bit at this stage.</p>
  
  <p>State of pState->m_msgCu:</p>
  
  <ul>
  <li>pState->m_msgCur    {msg=0x00000022 wp=0x0000000000000000 lp=0x0000000000000000}    tagMSG</li>
  <li>hwnd    0x0000000000020416 {unused=0x00000000 } HWND__ *
      message 0x00000022  unsigned int
      wParam  0x0000000000000000  unsigned __int64
      lParam  0x0000000000000000  __int64
      time    0x000f3967  unsigned long</li>
  <li>pt  {x=0x0000030f y=0x00000356} tagPOINT</li>
  </ul>