最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Call DLL methods from Javascript - Stack Overflow

programmeradmin1浏览0评论

I want to call a methods of a dll from javascript.

I followed this article Creating activex objects with c#

Since activeX works in IE only, how should I be able to call those methods from javascript in FireFox or Chrome?

I am already having an application which uses ActiveX object to call Dll Methods, but it works in IE only.

Is there any possible way that will make my application browser Independent?

UPDATED

I used Jquery async AJAX and webservice to call dll methods:

var to_return = $.ajax({
         type: "POST",
         url: "Default.aspx/CallMe", //CallMe is WebService method
         data: "{}", // parameter to pass
         async: false,
         contentType: "application/json; charset=utf-8",
         dataType: "json",
     });

     alert(to_return.responseText);

If CallMe() returns a string it is alerting it as {"d":"True"} where "True" is the string returned from CallMe.

How will I able to get only returned string from it?

Also, if CallMe() method of webservice returns an Object of a class present in that DLL? How can I retrieve that object in JavaScript? and Will I be able to call methods of that class using that returned object?

Please Help.

I want to call a methods of a dll from javascript.

I followed this article Creating activex objects with c#

Since activeX works in IE only, how should I be able to call those methods from javascript in FireFox or Chrome?

I am already having an application which uses ActiveX object to call Dll Methods, but it works in IE only.

Is there any possible way that will make my application browser Independent?

UPDATED

I used Jquery async AJAX and webservice to call dll methods:

var to_return = $.ajax({
         type: "POST",
         url: "Default.aspx/CallMe", //CallMe is WebService method
         data: "{}", // parameter to pass
         async: false,
         contentType: "application/json; charset=utf-8",
         dataType: "json",
     });

     alert(to_return.responseText);

If CallMe() returns a string it is alerting it as {"d":"True"} where "True" is the string returned from CallMe.

How will I able to get only returned string from it?

Also, if CallMe() method of webservice returns an Object of a class present in that DLL? How can I retrieve that object in JavaScript? and Will I be able to call methods of that class using that returned object?

Please Help.

Share Improve this question edited Jul 18, 2012 at 12:21 Prasad Jadhav asked Jul 17, 2012 at 6:48 Prasad JadhavPrasad Jadhav 5,22816 gold badges64 silver badges80 bronze badges 1
  • duplicate? stackoverflow./questions/9430619/… – rene Commented Jul 17, 2012 at 6:51
Add a ment  | 

2 Answers 2

Reset to default 3

You can't just execute a dll method in browser (this is done for security reasons).
In order to execute some piled code in browser you will have to use a plugin

ActiveX is just a method of implementing browser plugin in IE. All other browsers use different plugin interfaces.
Then if user will install your plugin in browser - this plugin will be available from JS and you can use it to execute some function in dll.

something like this should work :

var obj = new ActiveXObject("ABCDll.testMethod");
var vResult = obj.TestMethod();
alert(vResult);

:: update ::

check hazerd's answer from this link.

发布评论

评论列表(0)

  1. 暂无评论