Using ActiveX Com Components with nodejs. Is it possible

我与影子孤独终老i 提交于 2019-12-07 03:40:15

问题


Is there a way to use any ActiveX com components with nodejs?

Actually, I would never need this but I'm running nodejs on Windows and trying to send ping requests without forking new processes (no such module exists for Windows).

As some Activex components exist for sending ping requests with raw sockets, maybe I can use them.


An example of how you can create a COM object from JavaScript is:

var rs = new ActiveXObject("ADODB.Recordset");

回答1:


(updated)

You could try to use node-ffi to bind to Win32 and launch a COM/ActiveX component (CoCreateInstance) or access winsock/icmp directly. See https://github.com/rbranson/node-ffi

Or try to ping via WMI, e.g. "select * from win32_pingstatus where Address='...'". See https://npmjs.org/package/wmi




回答2:


There is node-win32ole ( npm install win32ole ).

EDIT: win32ole is no longer actively maintained. You could try winax instead.




回答3:


An ICMP ping module for Node.js now exists:

https://npmjs.org/package/net-ping




回答4:


Years later:

node winax

node win32ole no longer works with up to date node.js versions



来源:https://stackoverflow.com/questions/14356064/using-activex-com-components-with-nodejs-is-it-possible

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!