none
Speicherzugriff Fehler bei Aufruf System.Drawing RRS feed

  • Frage

  • Hallo Community,

    mir sind 2 Bücher über VB2010Express in die Hände gefallen. Das Programm (Deutsch dann Englisch) auf einem XP-Rechner installiert (incl. .NET 4.0). So weit so gut.

    Einige Übungen durchgeführt, diese sind auch problemlos gelaufen. Beim Aufruf

    " g.DrawLine(myPen, 10, 10, 100, 10)" wird der Fehler -  Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. - angezeigt

    System.AccessViolationException was unhandled
      Message=Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben.
      Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist.
      Source=System.Drawing
      StackTrace:
           bei System.Drawing.SafeNativeMethods.Gdip.GdipDrawLineI(HandleRef graphics,
               HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
           bei System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
           bei Grafik.Form1.Button1_Click(Object sender, EventArgs e) in
               x:\x\x\VB2010\Grafik1\Grafik\Form1.vb:Zeile 27.
           bei System.Windows.Forms.Control.OnClick(EventArgs e)
           bei System.Windows.Forms.Button.OnClick(EventArgs e)
           bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           bei System.Windows.Forms.Control.WndProc(Message& m)
           bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
           bei System.Windows.Forms.Button.WndProc(Message& m)
           bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg,
               IntPtr wparam, IntPtr lparam)
           bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.
               IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,
               ApplicationContext context)
           bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
               ApplicationContext context)
           bei System.Windows.Forms.Application.Run(ApplicationContext context)
           bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
           bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
           bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
           bei Grafik.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
           bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback,
               Object state, Boolean ignoreSyncCtx)
           bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback,
               Object state)
           bei System.Threading.ThreadHelper.ThreadStart()
      InnerException:

    Der Aufruf erfolgt in der Entwicklungsumgebung.

    Ich hoffe es hat jemand eine Idee woran es liegen könnte (GraKa o. ähnliches)

    Danke für hilfreiche Antworten.

    Dieter

    Dienstag, 24. März 2020 21:35

Alle Antworten