title: How can I programmatically inspect an ActiveXObject at runtime, using Javascript?
body: <p>I am looking to create a Javascript library for ActiveX objects, enabling chainability.</p>
  
  <p>For example, I am looking to replace this: </p>
  
  <pre><code>var dbEngine=new ActiveXObject('DAO.DBEngine.36');
  var dbs=dbEngine.OpenDatabase('D:\\Todo.mdb');
  var rs=dbs.OpenRecordset('SELECT * FROM ListItems');
  </code></pre>
  
  <p>with something like this (a la jQuery):</p>
  
  <pre><code>var rs=AX('DAO.DBEngine.36')
      .OpenDatabase('D:\\Todo.mdb')
      .OpenRecordset('SELECT * FROM ListItems');
  </code></pre>
  
  <p>I know I can do this:</p>
  
  <pre><code>var rs=new ActiveXObject('DAO.DBEngine.36')
      .OpenDatabase('D:\\Todo.mdb')
      .OpenRecordset('SELECT * FROM ListItems');
  </code></pre>
  
  <p>but I have no way of accessing the Database object from the Recordset object.</p>
  
  <p>In order to do this, the AX function should create the DBEngine object internally and inspect its members/properties, then expose corresponding methods on the the returned object.</p>
  
  <p>If the member/property returns an object, that object itself will be returned wrapped in the AX function.</p>