Accessing Windows COM objects from a Node.js program

4,194 views
Skip to first unread message

Daniel Gackle

unread,
Jan 19, 2012, 7:41:31 PM1/19/12
to nodejs
I have a Windows program that I need to call via COM. A nice way to do
this would be to write a Node.js server that runs on Windows, calls
the legacy app's COM objects, then serves up the data via HTTP. Is it
possible to access COM objects from server-side V8?

codepilot Account

unread,
Jan 19, 2012, 7:50:35 PM1/19/12
to nod...@googlegroups.com
Just write a middle layer in C++, shouldn't be too bad. I'm doing this soon, but in a more general way. I'm making a call translator so JS can call arbitrary C funcs. Also to state the obvious, I know node tries to be safe and stay in the JavaScript world, and I know this wouldn't even be close to safe, but I don't want to write c++ every time I want to call a dll.


--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Isaac Schlueter

unread,
Jan 19, 2012, 8:14:32 PM1/19/12
to nod...@googlegroups.com
codepilot Account, have you heard of node-ffi?
https://github.com/rbranson/node-ffi

codepilot Account

unread,
Jan 19, 2012, 9:30:39 PM1/19/12
to nod...@googlegroups.com

I think that is what I want. I have a bad habbit of just making things and asking questions later.

Simon

unread,
Jan 20, 2012, 3:35:35 AM1/20/12
to nod...@googlegroups.com
If you get it worked out using node-ffi or another way, let us know. On windows, that would open up heaps of possibilities..

Brandon Benvie

unread,
Jan 20, 2012, 5:42:31 AM1/20/12
to nod...@googlegroups.com
This is horribly coded and undocumented and basically terrible, but it is just about the only example you'll find of node-ffi doing stuff in Windows. The goal is auto-generating interfaces from header files, and then having generating even better source from those initial generated interfaces.

codepilot Account

unread,
Jan 20, 2012, 11:12:10 AM1/20/12
to nod...@googlegroups.com
In Euphoria they have a basic call_c_func procedure that calls c functions in dlls. I shoehorned it into calling com objects, and made directx 9 interface. Works easier than I thought. If node-ffi is similar than com shouldn't be too bad.

On Fri, Jan 20, 2012 at 12:35 AM, Simon <simon....@gmail.com> wrote:
If you get it worked out using node-ffi or another way, let us know. On windows, that would open up heaps of possibilities..

--

Nathan Rajlich

unread,
Jan 20, 2012, 1:48:25 PM1/20/12
to nod...@googlegroups.com
I maintain node-ffi, it works great on Windows. I'm not sure what C functions need to be called to interact with COM objects, but one of you Windows guys probably will. Let me know if you run into any troubles, but in short it should absolutely be possible :)
Reply all
Reply to author
Forward
0 new messages