locked
image to memory stream to MSpaint RRS feed

  • Question

  • User59672602 posted

    Hi,

     

    I am trying to write an image to a memorystream and then read the bytes from the memory stream and open the file with Mspaint.  Below is what I have done so far.  Any help would be appreciated.

     

    Try
                'MemoryStream stream = new MemorySteam();
                Dim stream As New MemoryStream()
                Dim fileName As String = "ChartPicture.bmp"
                Me.OlapChartcsi.Save(stream, fileName)
                Me.Response.Clear()
                Me.Response.AppendHeader("content-disposition", "attachment; filename=" & fileName)
                Me.Response.ContentType = "image/bmp"
                Me.Response.BinaryWrite(stream.ToArray())
                HttpContext.Current.ApplicationInstance.CompleteRequest()

                Dim oProcess As Process = New System.Diagnostics.Process()
                oProcess.StartInfo.FileName = "mspaint"

                oProcess.Start()

     


            Catch ex As Exception


            End Try

     

    Nina

    Tuesday, July 21, 2009 6:08 PM

All replies

  • User-1838637224 posted

     To open de saved image with MSPaint, you have to add the full path to the filename in the oProcess.StartInfo.Arguments property.

    Try to save it to "C:\test.bmp" and set the Arguments property to "C:\test.bmp" to find out what I mean.

    If you want to load it in MSPaint without saving to disk, try setting the image data to the clipboard en use sendkeys to trigger a paste.

    Cheers,

    Nick.

    Tuesday, August 11, 2009 8:40 AM