CLASS FILE -------------------- using System; using System.Text; using System.Runtime.InteropServices; using System.IO; namespace External { public class Class1 { public string Test() { return "Hi.. from External DLL."; } } } ----------------------------- HTML CODE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>New Document </title> <script type='text/javascript' language='javascript'> function comEventOccured() { try { alert("After ActiveX"); var myobject = new ActiveXObject("External.Test"); alert("Before ActiveX"); alert("Test1"); alert(myobject.TestMethod()); // call TO DLL Function. alert("After Call"); } catch (e) { alert(e.message); } } function startWord() { var strFile = "D:\\Temp\\File\\Doc.doc"; var myApp = new ActiveXObject("Word.Application"); if (myApp != null) { myApp.Visible = true; myApp.Documents.Open(strFile); } } function RunExe() { w = new ActiveXObject("WScript.Shell"); w.run('notepad.exe'); return true; } </script> </head> <body> <input type="button" value="Call Method from DLL" onclick="comEventOccured()"> <br /> <input type="submit" value="Start Word Doc" onclick="startWord()"> <br /> <input type="submit" value="Start Notepad" onclick="RunExe()"> </body> </html> ------------------------------ This working fine for startWord() and RunExe() but for comEventOccured() its giving msg of "Automation server can't create object"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)