Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help

Error Opening Gif in WorkSpaceViewer

  •  11 Jan 2008, 11:55 AM

    Error Opening Gif in WorkSpaceViewer

    I have a WorkspaceViewer with a Thumbnail Viewer below, and I am attempting to open a file from that thumbnail into the WorkspaceViewer, and I get this error:

    "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

    I have tracked this down to this line:

    imgCtrl.ApplyCommand(New Atalasoft.Imaging.ImageProcessing.Filters.BlurGaussianCommand(BlurLevel))

    This doesn't happen with every file, it is in a try Catch(), but it still causes the program to stop. Is there a way to check a file before this line so I don't call it if it will break?

    Here is the complete code:

    Try

    CurrentFile = strFileName

    imgCtrl.Open(strFileName)

    imgCtrl.AutoZoom = Atalasoft.Imaging.WinControls.AutoZoomMode.BestFit

    imgCtrl.MouseTool = Atalasoft.Imaging.WinControls.MouseToolType.None

    imgCtrl.ApplyCommand(New Atalasoft.Imaging.ImageProcessing.Filters.

    BlurGaussianCommand(BlurLevel))

     

    If frmMDI.mnuRecallZoom.Enabled Then

    Select Case iZoomMode

    Case Atalasoft.Imaging.WinControls.AutoZoomMode.None

    imgCtrl.ScrollPosition = New System.Drawing.Point

    (iStartX, iStartY)

    imgCtrl.Zoom = iStartZoom

    imgCtrl.Refresh()

     

    Case Atalasoft.Imaging.WinControls.AutoZoomMode.BestFit

    imgCtrl.AutoZoom =

    Atalasoft.Imaging.WinControls.AutoZoomMode.BestFit

     

    Case Atalasoft.Imaging.WinControls.AutoZoomMode.FitToWidth

    imgCtrl.AutoZoom =

    Atalasoft.Imaging.WinControls.AutoZoomMode.FitToWidth

    End Select

    Else

    imgCtrl.AutoZoom = Atalasoft.Imaging.WinControls.AutoZoomMode.BestFit

    End If

     

    SetMode((FileType.EViewerType.Image))

    imgCtrl.AntialiasDisplay = True

    Catch ex As Exception

    ErrorHandler.HandleError(ex, "DisplayImageInWorkSpaceViewer")

    End Try

     

    I can send the file I am getting the error on, it's just a gif. I just need to keep the program from crashing completely

    Thanks for you help

    Filed under: ,
View Complete Thread