ghuysmans / ocaml-activex

Bindings to ActiveX through winax (Node.js)
1 stars 0 forks source link

Understand wrapper functions #4

Open ghuysmans opened 2 years ago

ghuysmans commented 2 years ago

Properties aren't always wrapped. When does it happen? Field values in an ADODB recordset aren't wrapped, but WMI data are.

ghuysmans commented 2 years ago

This is implemented in winax/src/disp.cpp.

ghuysmans commented 2 years ago

Minimal example:

var winax = require("winax");

var conn = new winax.Object("ADODB.Connection");
conn.connectionString = "dsn=whatever";
console.log(typeof(conn.connectionString));

var wmi = new winax.Object("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2", {getobject: true});
var q = wmi.execQuery("SELECT * FROM Win32_IP4RouteTable");
console.log(typeof(q._NewEnum.Next().interfaceIndex.__value));
ghuysmans commented 2 years ago

ADSI has wrapped properties, too.

ghuysmans commented 2 years ago

getobject returns a dispatch "function":

console.log(conn); //null
console.log(wmi); //Dispatch