views:

346

answers:

0

I used a OCX which is designed to control Video. If I use OCX in the vb.net , and send command to get a snapshot picture,it would return a bytes array,then I turn it to be a stream then turn it to be a Image , then It would show it correctly.

but when I embbed OCX in webpage, It still work will,but I can`t catch the snapshot picture, if I use a Image Object to get , it still can not show the picture

How do I deal with it?

VB.NET code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim bytes() As Byte = ocx.GetCurrentImage()
    Dim ms As New System.IO.MemoryStream(bytes, 0, bytes.Length)
    Dim str As String = Encoding.UTF8.GetString(bytes)
    Dim pic As Image = Image.FromStream(ms)
    Dim newshot As New Snapshot
    newshot.Picture.Height = pic.Height
    newshot.Picture.Width = pic.Width
    newshot.Picture.Image = pic
    newshot.Show()
End Sub

JavaScript code:

var pic=New Image pic=ocx.GetCurrentImage();//the pic would be string,thats why I cant handle

Cloud Lin 2009.0312