1

I have written an activex user control to get an image from a user's clipboard. I have a method to get the byte stream for this image. I want to embed this into a asp.net webforms page (C#).

I am not sure how to call this method from the "code behind" portion of the asp.net page by using c#. I am not able to access the object from the "code behind" portion.

I am trying to accompish this by using Javascript but I keep getting the error:

Microsoft JScript runtime error: 'ScreenCapMod1' is undefined

This is the HTML code:

    <div id="panelScn" style="height:258px;">

        <object id="ScreenCapMod1" name="ScreenCapMod1" height="812" width="689"
            classid="ScreencaptureActiveX.dll#Screencapture_ActiveX.ScreenCapModule">
        </object>
     <input type=button value="Click me" onClick="doScript();">

function doScript() { ScreenCapMod1.getScreenshot(); }

This is the code for the get screenshot method:

    public byte[] getScreenshot()
    {
        if (picBoxImagePrev.Image != null)
        {
            MemoryStream stream = new MemoryStream();
            scaledScreenCapture.Save(stream, ImageFormat.Png);
            imgStream = stream.ToArray();
        }
        return imgStream;
    }

1 Answer 1

1

The ActiveX control will run on the client side, so you need some way of pushing that data from the client to the server. A standard web service should accomplish this for you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.