npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

winax-dynamic-linking

v1.0.4

Published

Windows COM bindings

Downloads

15

Readme

Name

Windows C++ Node.JS addon, that implements COM IDispatch object wrapper, analog ActiveXObject on cscript.exe

Features

  • Using ITypeInfo for conflict resolution between property and method (for example !rs.EOF not working without type information, becose need define EOF as an object)

  • Using optional parameters on constructor call

var con = new ActiveXObject("ADODB.Connection", {
	activate: false, // Allow activate existance object instance, false by default
	async: true, // Allow asynchronius calls, true by default (for future usage)
	type: true	// Allow using type information, true by default
});
  • Create COM object from JS object and may be send as argument (for example send to Excel procedure)
var com_obj = new ActiveXObject({
	text: test_value,
	obj: { params: test_value },
	arr: [ test_value, test_value, test_value ],
	func: function(v) { return v*2; }
});
  • Additional dignostic propeties:
    • __id - dispatch identity, for exmplae: [email protected]
    • __value - value of dispatch object, equiles valueOf()
    • __type - list member names with their properties

Usage example

Install package throw NPM (see below Building for details)

npm install winax

Create ADO Connection throw global function

require('winax');
var con = new ActiveXObject('ADODB.Connection');

Or using Object prototype

var winax = require('winax');
var con = new winax.Object('ADODB.Connection');

Open connection and create simple table

con.Open('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\tmp;Extended Properties="DBASE IV;"', '', '');
con.Execute("Create Table persons.dbf (Name char(50), City char(50), Phone char(20), Zip decimal(5))");
con.Execute("Insert into persons.dbf Values('John', 'London','123-45-67','14589')");
con.Execute("Insert into persons.dbf Values('Andrew', 'Paris','333-44-55','38215')");
con.Execute("Insert into persons.dbf Values('Romeo', 'Rom','222-33-44','54323')");

Select query and return RecordSet object

var rs = con.Execute("Select * from persons.dbf"); 
var reccnt = rs.RecordCount;

Inspect RecordSet fields

var fields = rs.Fields;
var fldcnt = fields.Count;

Process records

rs.MoveFirst();
while (!rs.EOF) {
	var name = fields("Name").value;
	var town = fields("City").value;
	var phone = fields("Phone").value;
	var zip = fields("Zip").value;   
	console.log("> Person: " + name + " from " + town + " phone: " + phone + " zip: " + zip);    
	rs.MoveNext();
}

Or using fields by index

rs.MoveFirst();
while (rs.EOF != false) {
	var name = fields[0].value;
	var town = fields[1].value;
	var phone = fields[2].value;
	var zip = fields[3].value;   
	console.log("> Person: " + name + " from " + town + " phone: " + phone + " zip: " + zip);    
	rs.MoveNext();
}

Release COM objects (but other temporary objects may be keep references too)

winax.release(con, rs, fields)

Tutorial and Examples

Building

This project uses Visual C++ 2013 (or later versions then support C++11 standard). Bulding also requires node-gyp and python 2.6 (or later) to be installed. You can do this with npm:

npm install -g node-gyp

To obtain and build use console commands:

git clone git://github.com/durs/node-axtivex.git
cd node-activex
node-gyp configure
node-gyp build

For Electron users, need rebuild with a different V8 version:

npm rebuild winax --runtime=electron --target=1.4.3 --disturl=https://atom.io/download/atom-shell --build-from-source

See also Electron Documentation: Using Native Node Modules

Tests

mocha is required to run unit tests.

npm install -g mocha
mocha test

Contributors