node-activex icon indicating copy to clipboard operation
node-activex copied to clipboard

DispInvoke: XXX Error

Open minkee-lee opened this issue 1 year ago • 1 comments

(Maybe this is not an issue, just a question.)

I made tutorial OCX using visual studio 2015 (using MFC ActiveX Control project). And try testing with winax like following .. and got error.

This is my code (The function AboutBox() of tutorial OCX just shows an about window.)

var con = new ActiveXObject("MFCACTIVEXCONTRO.MFCActiveXControCtrl.1");
console.log(con)
con.AboutBox();

and npm start result in...

<ref *1> [Function: undefined] Dispatch {
  [__vars]: {},
  [__methods]: {
    AboutBox: { name: 'AboutBox', dispid: -552, invkind: 1, flags: 0, argcnt: 0 }
  },
  [__type]: [
    { name: 'AboutBox', dispid: -552, invkind: 1, flags: 0, argcnt: 0 }
  ],
  [__value]: [Circular *1],
  [__id]: 'MFCACTIVEXCONTRO.MFCActiveXControCtrl.1'
}
(node:55900) UnhandledPromiseRejectionWarning: Error: DispInvoke: AboutBox 오류입니다.

    at Dispatch.<anonymous> (<anonymous>)

I think OCX loaded well but something wrong with function call..

But another built-in(?) OCX success.

  var whs = new ActiveXObject("WScript.Shell");
  whs.Popup("hello");  // It shows a popup correctly.

Any help.. would be great Thanks in advance.

More test) Calling my OCX in visual studio MFC project ... works correct.

(Calling an AboutBox() shows about dialog well.) image

minkee-lee avatar Jun 19 '23 01:06 minkee-lee

For initialization OCX (ActiveX Control) requires a window subsystem, message queue processing etc. NodeJS does not provide this. Only simple ATL Object/MFC Class/COM Automation Object can be used.

durs avatar Jun 19 '23 08:06 durs