5

I have created an ActiveX dll using VB6 and packaged it using the Package & Deployment Wizard which has resulted in a cab file and a demo HTML page.

This ActiveX dll contains a simgle method that returns a string and accepts no arguments.

The trouble I'm having is that when I call the method I always get a "Object does not support this property or method" error. But it does support the method I'm calling.

What I'm trying to achieve is for users to go to a web page that has some java or vb script in it that calls method in my ActiveX and gets the string value returned. The DLL is intended to be called client side.

My test web page is as follows:

<html>
<head>
    <title>SaveClipboardImage.CAB</title>
    <object id="Class1" classid="CLSID:" codebase="SaveClipboardImage.CAB#version=1,0,0,0"></object>
    <script type="text/javascript">
            function displaymessage()
            {
                try
                {
                var filename;

                filename = Class1.SaveClipboardToImage();

                alert(filename);
                }
                catch(e)
                {
                    alert(e.message);
                }               
            }
    </script>
</head>
<body>      
    <input type="BUTTON" onclick="displaymessage()" value="preview" />
</body>
</html>

I'm obviously doing something wrong, but I don't know what. Do I have to do something special to the class in the VB6 project so I can access the method? Am I calling the DLL incorrectly?

Thanks for your help.

1
  • Can you post the VB6 code for SaveClipboardToImage? Commented May 13, 2009 at 15:37

1 Answer 1

6

Javascript knows nothing about Class1. You have to get the object into javascript.

Try:

        function displaymessage()
        {
            try
            {
                var filename;
                var class1 = document.getElementById("Class1");
                filename = class1.SaveClipboardToImage();

                alert(filename);
            }
            catch(e)
            {
                alert(e.message);
            }                       
        }
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.