在VS2010中使用native / C ++代码创建一个简单的COM对象最简单的方法是什么? [英] What is the easiest way to create a simple COM object in VS2010 using native/C++ code?

查看:182
本文介绍了在VS2010中使用native / C ++代码创建一个简单的COM对象最简单的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我发布的先前问题的后续内容(请参阅这里)。我试图从Javascript在HTML页面中调用我的本机/ C ++代码。引用问题中的答案是创建一个COM对象。然后,Javascript可以创建一个COM对象的实例,并调用它的方法获得本机/ C ++代码。

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.

现在我留下来试图创建一个简单的COM对象接受来自Javascript的调用。看起来像是要创建一个DLL并将COM对象放在该DLL中。几年前,我做了大量的阅读在COM,并试图忘记它从那时:)现在我有一个头痛想知道如何轻松地去这不难成为COM的专家。

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.

有一个简单/容易的方法来设置一个DLL,你将推荐一个COM对象?

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

编辑:我的应用程序是使用本机C / Win32 / MFC。我有一个MFC对话框,它使用IE ActiveX浏览器控件来呈现本地生成的HTML。目前的按钮处理程序代码都是在Javascript中,但正如你可以看到从引用的问题,我的目标是在C + +处理它。

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.

推荐答案

由于我知道创建COM对象的简单快捷的方法是创建一个ATL项目。
这里是一个不错的教程,说明后续步骤。

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.

这篇关于在VS2010中使用native / C ++代码创建一个简单的COM对象最简单的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆