Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Can this be used to embed activex control in electron application? #15

Closed
dustintownsend opened this issue Aug 23, 2017 · 6 comments

Comments

@dustintownsend
Copy link

Before I go down the rabbit hole I wanted to see if you think this was possible. Since Electron is built on Chrome and Chrome doesn't support ActiveX I am thinking it is not possible.

Thanks!

@durs
Copy link
Owner

durs commented Aug 23, 2017

No, it will not work.
Can be used only COM Automated objects without an User Interface part.

@kylebarron
Copy link

I've been trying to develop a package for Atom that uses this module, but since Atom is built on Electron, does that mean it's impossible? Is there any workaround?

I'm pretty new to Javascript/node/electron so I just wanted to ask.

Thanks!

@durs
Copy link
Owner

durs commented Nov 30, 2017 via email

@kylebarron
Copy link

Even after rebuilding with the current electron version, it's not working from node. My node version is v.7.4.0, the same as electron is using.

C:\Users\Kyle\github\atom\stata-exec> npm install winax
C:\Users\Kyle\github\atom\stata-exec> npm install --save-dev electron-rebuild
C:\Users\Kyle\github\atom\stata-exec> .\node_modules\.bin\electron -v
v1.4.13
C:\Users\Kyle\github\atom\stata-exec> .\node_modules\.bin\electron-rebuild.cmd -v 1.4.13
√ Rebuild Complete

But then in node,

> var winax = require('winax');
\\?\C:\Users\Kyle\github\atom\stata-exec\node_modules\winax\build\Release\node_activex.node
    at Object.Module._extensions..node (module.js:598:18)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Kyle\github\atom\stata-exec\node_modules\winax\activex.js:1:94)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)

Rebuilding the modules with node-gyp seems to work.

C:\Users\Kyle\github\atom\stata-exec\node_modules\winax> node-gyp configure
C:\Users\Kyle\github\atom\stata-exec\node_modules\winax>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure )  else (node "" configure )
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@7.4.0 | win32 | x64
gyp info spawn C:\Users\Kyle\.windows-build-tools\python27\python.exe
gyp info spawn args [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Kyle\\github\\atom\\stata-exec\\node_modules\\winax\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Kyle\\.node-gyp\\7.4.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Kyle\\.node-gyp\\7.4.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Kyle\\github\\atom\\stata-exec\\node_modules\\winax',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\Kyle\\github\\atom\\stata-exec\\node_modules\\winax\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok
> node-gyp build
C:\Users\Kyle\github\atom\stata-exec\node_modules\winax>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" build )  else (node "" build )
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@7.4.0 | win32 | x64
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  main.cpp
  utils.cpp
  disp.cpp
  win_delay_load_hook.cc
     Creating library C:\Users\Kyle\github\atom\stata-exec\node_modules\winax\build\Release\node_activex.lib and object
   C:\Users\Kyle\github\atom\stata-exec\node_modules\winax\build\Release\node_activex.exp
  Generating code
  Finished generating code
  node_activex.vcxproj -> C:\Users\Kyle\github\atom\stata-exec\node_modules\winax\build\Release\\node_activex.node
  node_activex.vcxproj -> C:\Users\Kyle\github\atom\stata-exec\node_modules\winax\build\Release\node_activex.pdb (Full
  PDB)
gyp info ok

And when I run examples\ado.js, I get a weird error:

C:\Users\Kyle\github\atom\stata-exec\node_modules\winax>node.exe examples\ado.js
==> Preapre directory and delete DBF file on exists
==> Open connection
ADO version: 10.0
C:\Users\Kyle\github\atom\stata-exec\node_modules\winax\examples\ado.js:23
con.Open(constr, "", "");
    ^

Error: DispInvoke: Open Provider cannot be found. It may not be properly installed.
    at Object.<anonymous> (C:\Users\Kyle\github\atom\stata-exec\node_modules\winax\examples\ado.js:23:5)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3

Any ideas? Thanks for your help!

@kylebarron
Copy link

I got the package to load in node in the terminal, and now when I try to load the module in Electron, I get the error

Uncaught Error: A dynamic link library (DLL) initialization routine failed.

I rebuilt the winax module, and I'm trying to follow #5, but it's not working. The result of mocha test\ado.js is below:

C:\Users\Kyle\github\atom\stata-exec\node_modules\winax>mocha test\ado.js


  Scripting.FileSystemObject
    √ create
    √ create data folder if not exists
    √ delete DBF file if exists

  ADODB.Connection
    1) create and open
    2) create and fill table
    3) select records from table
    √ loop by records

  Release objects
    √ release: 2
    √ double release: 0
    √ try call: FAILED (DispNull)


  7 passing (14ms)
  3 failing

  1) ADODB.Connection
       create and open:
     Error: DispInvoke: Open Provider cannot be found. It may not be properly installed.
      at Context.<anonymous> (test\ado.js:38:13)

  2) ADODB.Connection
       create and fill table:
     Error: DispInvoke: Execute Operation is not allowed when the object is closed.
      at Context.<anonymous> (test\ado.js:44:17)

  3) ADODB.Connection
       select records from table:
     Error: DispInvoke: Execute Operation is not allowed when the object is closed.
      at Context.<anonymous> (test\ado.js:54:26)

@durs
Copy link
Owner

durs commented Dec 5, 2017 via email

@durs durs closed this as completed Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants