2

I want to call a function from javascript.

Ex . I have a activex control with a button named "btn" ,

i want to return its caption using js,is technically possible ?

Also how can i write custom functions in vb6 Activex Control ? and i need to embed the control on a web page.

ex.

Option Explicit
Public Function getText(ByVal message As String) As String
MsgBox message
End Function

Private Sub UserControl_Initialize()
Call getText("test")
End Sub

I want to call getText from javascript.

Thank you.

1 Answer 1

4

You'll first need to package the ActiveX for web deployment (see MSDN library for more details).

As for the code, here's an example

<object classid="clsid:24638d61-2aeb-1cd2-b12f-a08048fdd814"
  codebase="http://www.myserver.com/myactivex.cab#Version=1.0.0.1"></object>

<script>
  onload = function() {
    var myobj = new ActiveXObject('MyActiveX.MyObj');
    myobj.getText('test');
  };
</script>
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.