PDA

View Full Version : System.AccessViolationException کسی میتونه کمک کنه؟



combo_ci
شنبه 26 خرداد 1386, 11:09 صبح
من یه برنامه نوشتم که چند تا کلیپ quick time رو با زدن رو پخش کنه....
برنامم دو تا دکمه play و next clip داره ...کلیپ اول رو توی لود برنامه ست میکنم و برنامه اونو بدون مشکل نشون میده اما و روی next clip کلیک میکنم و بعد روی دکمه play کلیک میکنم با خطای زیر مواجه میشم :

"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.AxHost.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageA(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at QuickPlayer.Program.Main() in D:\\MyDoc\\My Project\\Q\\QuickPlayer\\QuickPlayer\\Program.cs:l ine 24"

کسی میتونه منو کمک کنه؟

kiani.mehdi
شنبه 26 خرداد 1386, 11:45 صبح
من یه برنامه نوشتم که چند تا کلیپ quick time رو با زدن رو پخش کنه....
برنامم دو تا دکمه play و next clip داره ...کلیپ اول رو توی لود برنامه ست میکنم و برنامه اونو بدون مشکل نشون میده اما و روی next clip کلیک میکنم و بعد روی دکمه play کلیک میکنم با خطای زیر مواجه میشم :

"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.AxHost.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageA(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at QuickPlayer.Program.Main() in D:\\MyDoc\\My Project\\Q\\QuickPlayer\\QuickPlayer\\Program.cs:l ine 24"

کسی میتونه منو کمک کنه؟


نمونه کد و اونجایی که خطا میده را بذار تا بشه بهتر کمک کرد
موفق باشید
مهدی کیانی

combo_ci
شنبه 26 خرداد 1386, 12:16 عصر
این خطا تو تابع main رخ میده
static void Main()
{
string errMsg = "";

try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new Form1());
}
catch (COMException ex)
{
// catch COM exceptions from QT control
errMsg = "Error Code: " + ex.ErrorCode.ToString("X") + "\n";
QTUtils qtu = new QTUtils();
errMsg += "QT Error code : " + qtu.QTErrorFromErrorCode(ex.ErrorCode).ToString();
}
catch (Exception ex)
{
// catch any exception
errMsg = ex.ToString();
}
if (errMsg != "")
{
string msg = "Error in form1:\n\n";
msg += errMsg;
MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}