Please help! System.Access.Violation exception

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello.

I am I cognitive psychology graduate student designing an experiment that uses opengl and windows forms.  I started developing the program on an XP system but have since gotten a new computer that runs Vista (I am using Visual Studio 2005).  Now the program produces a "system.access.violation - Attempt to read or write protected memory" exception.  This occures at the point in the code that the opengl buffers are swapped.


<div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white
<table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0>
<colgroup>
<col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap
<tbody>
<tr>
<td><font style="font-size:11px System::Void SwapOpenGLBuffers(System::Void)          </font></td></tr>
<tr>
<td style="background-color:#f7f7f7 {  </td></tr>
<tr>
<td>            SwapBuffers(m_hDC) ;          </td></tr>
<tr>
<td style="background-color:#f7f7f7 } </td></tr></tbody></table>
To implement opengl on a windows form I use an excellent code example from "The Code Project" website.

http://www.codeproject.com/KB/miscctrl/OpenGLViewWinForms.aspx?msg=2672450#xx2672450xx Creating an OpenGL view on a Windows Form

The example project downloadable there also produces this exception at the same place.

I am by no means an expert programmer so any help would be greatly appreciated.

Thanks!

View the full article
 
Back
Top