2
votes

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

1 Answers

4
votes

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>