title: Get Unhandled exception at 0x00f85069
body: <p>my program breaks and says this</p>
  
  <pre><code>Unhandled exception at 0x00f85069 in Monopoly.exe: 0xC0000005: Access violation writing location 0x0000000c.
  </code></pre>
  
  <p>i made a win32 wrapper. i have two WndProc one is static and the other one not. the static WndProc calls the nonstatic WndProc.  when i try to get messages it works fine but when i try to set a value for something it throw a exception.<br>
  here is my code for two WndProc(the first one its that static)</p>
  
  <pre><code>LRESULT CALLBACK Window::StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) 
  { 
     if ( msg == WM_CREATE ) 
     { 
         SetWindowLongPtr( hWnd, GWLP_USERDATA, (LONG)((CREATESTRUCT *)lParam)-&gt;lpCreateParams ); 
     }
     Window *targetApp = (Window*)GetWindowLongPtr( hWnd, GWLP_USERDATA );
  
     return targetApp-&gt;WndProc( hWnd, msg, wParam, lParam ); 
  }
  
  LRESULT CALLBACK Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
  
      switch (message)
      {
      case WM_PAINT:
          break;
      case WM_DESTROY:
          PostQuitMessage(0);
          break;
      case WM_LBUTTONDOWN:
          z=-14; //IT THROW EXCEPTION
          break;
      case WM_RBUTTONDOWN:
          z-=1;
          break;
      default:
          return DefWindowProc(hWnd, message, wParam, lParam);
      }
      return 0;
  }
  </code></pre>
  
  <p>Thanks in Advance</p>
  
  <p><strong>EDIT:</strong><br>
  VARABILES<br>
  int z;</p>