What is the easiest way to create a simple COM obj

2019-07-12 04:27发布

This is a followon to a prior question I posted (see here). I'm trying to call my native/C++ code from Javascript running in an HTML page. The answer in the referenced question was to create a COM object. The Javascript can then create an instance of the COM object and invoke methods on it getting to the native/C++ code.

So now I'm left with trying to create a simple COM object to accept the call from the Javascript. It looks like the way to go is to create a DLL and put the COM object in that DLL. Years ago I did tons of reading on COM and have tried to forget it since then :) Now I'm getting a headache wondering how to go about this easily without becoming an expert in COM.

Is there a simple/easy way to setup a DLL with a COM object that you would recommend?

EDIT: My application is written using native C++/Win32/MFC. I have an MFC dialog which uses the IE ActiveX browser control to render locally generated HTML. Currently the button handler code is all in Javascript, but as you can see from the referenced question, my goal is to handle it on the C++ side.

标签: c++ windows com
1条回答
何必那么认真
2楼-- · 2019-07-12 05:07

As I know the easy and fast way to create COM objects is to create an ATL project. here's a nice tutorial that explains the steps to follow.

查看更多
登录 后发表回答