atl

How can I convert a JavaScript array() to an ATL/COM array?

巧了我就是萌 提交于 2019-11-29 12:10:47
How can I convert a JavaScript array() to an ATL/COM array without using VBArray? What I want to convert is a new Array() to a SAFEARRAY. Here's a code to do just that (considering you already got the JS Array object as a C++ Variant), same way as Sheng Jiang suggested earlier: bool VariantToArray(__in const CComVariant& var, __out vector<CComVariant>& vecVars) { // convert variant to dispatch object CComPtr<IDispatch> pDispatch = VariantToDispatch(var); if (!pDispatch) return false; // invoke the object to retrieve the enumerator containing object CComVariant varResult; DISPPARAMS

How to use COM to transfer Data between two processes (for IPC - inter process communication)

爱⌒轻易说出口 提交于 2019-11-29 10:45:32
i have a average knowledge in COM and will like to understand how COM helps in data transfer. Assuming there are two processes, Process-A and Process-B and both of them wants share some data with each other, of course there are many RPC mechanisms but i would like to use COM. you cannot create a COM dll because then it would become specific to process and cannot be used can we create a Single ton COM EXE server and wrap the structure in COM CoClass and expose it members as properties and then ...no idea how to ? Above is my understanding, can anyone of you help me clear my understanding on

Warning C4251 when building a DLL that exports a class containing an ATL::CString member

房东的猫 提交于 2019-11-29 05:53:53
问题 I am converting an ATL-based static library to a DLL and am getting the following warning on any exported classes that use the ATL CString class (found in atlstr.h): warning C4251: 'Foo::str_' : class 'ATL::CStringT' needs to have dll-interface to be used by clients of class 'Foo' I am correctly declaring the Foo class as exported via __declspec(dllexport) . Is this a warning I can safely ignore or am I doing something wrong? The DLL project settings are set to dynamically link with ATL, but

STL,ATL,WTL之间的联系和区别

旧街凉风 提交于 2019-11-28 23:15:07
STL即 Standard Template Library (标准模板库) STL是惠普实验室开发的一系列软件的统称。它是由Alexander Stepanov、Meng Lee和David R Musser在惠普实验室工作时所开发出来的。现在虽说它主要出现在C++中,但在被引入C++之前该技术就已经存在了很长的一段时间。 STL的代码从广义上讲分为三类: algorithm(算法)、container(容器)和iterator(迭代器), 几乎所有的代码都采用了模板类和模版函数的方式 ,这相比于传统的由函数和类组成的库来说提供了更好的代码重用机会。 从根本上说,STL是一些“容器”的集合,这些“容器”有list,vector,set,map等,STL也是算法和其他一些组件的集合。 这里的“容器”和算法的集合指的是世界上很多聪明人很多年的杰作。 STL的目的是标准化组件,这样你就不用重新开发它们了。你可以仅仅使用这些现成的组件。STL现在是C++的一部分,因此不用额外安装什麽。 它被内建在 你的编译器之内。因为STL的list是一个简单的容器,所以我打算从它开始介绍STL如何使用。如果你懂得了这个概念,其他的就都没有问题了。另外,list容器是相当简单的,我们会看到这一点。 这篇文章中我们将会看到如何定义和初始化一个list,计算它的元素的数量,从一个list里查找元素,删除元素

VS2010 简单ATL COM开发

℡╲_俬逩灬. 提交于 2019-11-28 16:46:37
1、 打开VS2010,新建ATL COM 项目,步骤:“文件” --》“新建” --》“项目”,选择“Visual C++” --》“ATL 项目” ,填写“名称” FirstCOM --》“确定”。 2、ATL 项目向导, 勾选 【支持COM+ 1.0】和【支持部件注册器】,其他默认,点击完成。 3、切换到类视图,右键单击项目“FirstCOM”--》“添加” --》“类”。 4、 选“ATL” --》“ATL 简单对象” --》“添加”。 5、ATL 简单对象向导,“ 简称”中输入类名称FirstClass,其他输入框会自动填写, 最下面的“ProgID”没有自动填写,最好自己写上一个,如FirstCOM.math,否则后面无法正确调用组件 ,点击“完成”。如果出现提示【是否覆盖现有文件】,点击【是】即可。 6、 切换到类视图,选中刚才添加的接口IFirstClass,如下,然后右键单击【添加】添加方法。 7、添加方法向导,在"方法名" 下输入Add。增加两个输入参数:勾选【in】,选择参数类型LONG,输入参数名para1,点击“添加”。同样操作增加参数para2。然后增加一个返回参数:先选择参数类型LONG*,再勾选【retval】,输入参数名result,点击添加。 点击“完成”即可,如果点击下一步,不需要填写信息,点击“完成”即可。 8、 切换到解决方案资源管理器

How do I decide whether to use ATL, MFC, Win32 or CLR for a new C++ project?

烈酒焚心 提交于 2019-11-28 15:46:40
I'm just starting my first C++ project. I'm using Visual Studio 2008 . It's a single-form Windows application that accesses a couple of databases and initiates a WebSphere MQ transaction. I basically understand the differences among ATL, MFC, Win32 (I'm a little hazy on that one actually) and CLR, but I'm at a loss as to how I should choose. Is one or more of these just there for backward-compatibility? Is CLR a bad idea ? Any suggestions appreciated. Edit: I've chosen C++ for this project for reasons I didn't go into in the post, which are not entirely technical. So, assuming C++ is the only

Adding ATL support to existing mfc application

喜你入骨 提交于 2019-11-28 13:05:48
I want to implement MFC Docking Framework in my existing mfc application I have taken same trial, but it gives me assertion like before execution of my project. In output window a text appears like: "Performing registration" and after that appeared below assertion File: c:\program files\microsoft visual studio.net 2003\vc7\atlmfc\include\atlbase.h Line: 2619 Expression: _pAtlModule == 0 For an existing MFC application, you can go to menu Project , Add Class , and under ATL you have an option Add ATL Support To MFC . This should add ATL initialization and the module will no longer be NULL . 来源:

Use CString in console app when using VS Express

大城市里の小女人 提交于 2019-11-28 10:15:37
问题 I have a problem when trying to use CString. I have a console application written using VS2010Express. I have a piece of code I would like to use, but it uses CString. When I try to include the appropriate header atlstr.h (as far as I know) I get the famous error: Cannot open source file. After Goggling around for a while it seems that in general it should be possible, but the atlstr.h is not available to Express users. Questions: 1) Is that right ? 2) Can I avoid this problem somehow? Below

CComVariant vs. _variant_t, CComBSTR vs. _bstr_t

 ̄綄美尐妖づ 提交于 2019-11-28 09:46:46
I am using ATL (VS2008, so ATL9 IIRC) to create COM objects and have been using the CComVariant class (defined in atlcomcli.h ) to manage VARIANT types. However, there is also another VARIANT wrapper called _variant_t . Is there any difference between CComVariant and _variant_t and which one should I be using? Similarly, there are two BSTR wrappers available - CComBSTR and _bstr_t . Again, which should I prefer and why? _variant_t and _bstr_t are provided by the compiler as COM support classes and get used when you use constructs like #import . You can use them if you like. CComVariant and

Create CImage from Byte array

帅比萌擦擦* 提交于 2019-11-28 09:29:50
问题 I need to create a CImage from a byte array (actually, its an array of unsigned char , but I can cast to whatever form is necessary). The byte array is in the form "RGBRGBRGB...". The new image needs to contain a copy of the image bytes, rather than using the memory of the byte array itself. I have tried many different ways of achieving this -- including going through various HBITMAP creation functions, trying to use BitBlt -- and nothing so far has worked. To test whether the function works,