Scipts tends to be changed more often than ActiveX. Better if you change your design. Declare some events and handle them in scripts, and in turn the event handlers call script functions.
If you really want to call scripts from your ActiveX hosted by Internet Explorer, you need to first access the container document
Type typeIOleObject = this.GetType().GetInterface("IOleObject",true); object oleClientSite = typeIOleObject.InvokeMember("GetClientSite", BindingFlags.Instance|BindingFlags.InvokeMethod|BindingFlags.Public, null,this,null);
IOleClientSite oleClientSite2 = oleClientSite as IOleClientSite; IOleContainer pOleContainer; oleClientSite2.GetContainer(out pOleContainer);
and then access its script property IHTMLDocument pDoc1 = (IHTMLDocument)pOleContainer; object script=pDoc1.Script;
If you know the signature of the function, you can call the function with zero or more arguments
object [] args;
//set up the args array with arguments
script.GetType().InvokeMember("functionName",BindingFlags.Instance|BindingFlags.InvokeMethod|BindingFlags.Public,null,script,args);
|