atl

How to Cleanly Destroy WebBrowser Control

落爺英雄遲暮 提交于 2019-12-03 00:46:07
I am using ATL in VisualC++10 to host browser control. My code is similar to this example: http://msdn.microsoft.com/en-us/library/9d0714y1(v=vs.80).aspx Difference is I have main window and then child window hosts the browser control. After 2 minutes i have to close the browser completely kill the browser activeX but this child window should be alive and do something else. But somehow this browser control still stays there, i can either see scrollbars or something.. I have also tried by creating child window to an existing child window, and at the time of closing browser I then destroy this

Right single apostrophe vs. apostrophe?

删除回忆录丶 提交于 2019-12-03 00:10:21
Right single quotation mark (U+2019) vs. Apostrophe (U+0027) What is the difference between these two characters? I ran into this issue where I use CAtlString to load a string from a resource file, and on some Windows installations, the LoadString fails when trying to load a string that contains U+2019, but it works on some other Windows installations. The U+2019 character appears in strings in my resource file that I copied from Word, and U+0027 appears in stirngs that I hand coded. Why does LoadString (sometimes) choke on this? What is the difference between these two characters? Arguable!

What's the fundamental difference between MFC and ATL?

这一生的挚爱 提交于 2019-12-02 13:50:22
Assuming I am only using them for "normal" GUI programs (no COM, no ActiveX, nothing fancy), what is the fundamental difference I will see between ATL and MFC, to help me figure out which one to use? I've done some searches on the web, but ultimately none of the answers really answered my question: http://msdn.microsoft.com/en-us/library/bk8ytxz5(v=vs.80).aspx : "ATL is a fast, easy way to both create a COM component in C++ and maintain a small footprint. Use ATL to create a control if you don't need all of the built-in functionality that MFC automatically provides." Doesn't really answer my

How to embed Windows Form in unmanaged ATL GUI?

痴心易碎 提交于 2019-12-02 12:35:04
问题 I have a Windows form user control that is made COM visible. Now I want to embed that control into an ATL dialog GUI. The ATL project (unmanaged C++) shall only get the progID of the winform and dynamically create and embed it at runtime. Is this possible and if so, how do I do it? 回答1: I am not sure about ATL but this can be done easily in MFC using CWinFormsView and CWinFormsControl classes. I think there is no bulitin support to host a WinForm Control in an ATL Window but I think you can

How to compare two BSTRs or CComBSTRs?

十年热恋 提交于 2019-12-02 07:40:53
问题 What is the right way to compare two CComBSTRs? I tried to use bool operator ==( const CComBSTR& bstrSrc ) const throw( ); However it always return false even two ComBSTRs are the same. It did not work correctly. Do I have to convert CComBSTRs to ANSI string first and then use strcmp? Thanks! -bc 回答1: You should probably use VarBstrCmp. EDIT: this is actually what CComBSTR::operator== does, so without further context, your code may be incorrect. 回答2: BSTRs (and therefore CComBSTRs) are

Why would QueryInterface() fail when the interface is surely implemented and has built-in marshaller in Windows?

a 夏天 提交于 2019-12-02 06:22:22
问题 I have the following setup. There's a COM server that is installed into COM+ (to run in a separate process) and has this interface definition: [object, uuid("InterfaceIdHere"), nonextensible, oleautomation, hidden] interface IMyInterface : IUnknown { HRESULT MyMethod( [in] IUnknown* param ); }; The caller calls it like this: HRESULT callComObject(IStream* stream) { return comObject->MyMethod(stream); } Note that here IStream* is implicitly upcasted to IUnknown* . This is done because

How to embed Windows Form in unmanaged ATL GUI?

风格不统一 提交于 2019-12-02 04:45:42
I have a Windows form user control that is made COM visible. Now I want to embed that control into an ATL dialog GUI. The ATL project (unmanaged C++) shall only get the progID of the winform and dynamically create and embed it at runtime. Is this possible and if so, how do I do it? I am not sure about ATL but this can be done easily in MFC using CWinFormsView and CWinFormsControl classes. I think there is no bulitin support to host a WinForm Control in an ATL Window but I think you can do it by simple getting the HWND of your winform control and setting your ATL control as its parent. This

Why would QueryInterface() fail when the interface is surely implemented and has built-in marshaller in Windows?

让人想犯罪 __ 提交于 2019-12-02 03:35:24
I have the following setup. There's a COM server that is installed into COM+ (to run in a separate process) and has this interface definition: [object, uuid("InterfaceIdHere"), nonextensible, oleautomation, hidden] interface IMyInterface : IUnknown { HRESULT MyMethod( [in] IUnknown* param ); }; The caller calls it like this: HRESULT callComObject(IStream* stream) { return comObject->MyMethod(stream); } Note that here IStream* is implicitly upcasted to IUnknown* . This is done because declaring a parameter of type IStream* in IDL caused some problems that I can't recall right now. Anyway it's

新建com组件项目步骤

痞子三分冷 提交于 2019-12-02 03:14:09
一、菜单栏 新建->项目->ATL->ATL项目->动态链接库 后续默认完成 二、菜单栏 项目->添加类->ATL控件->“写入类的命名如:CeshiMain”下一步-> 1、如果需要连接点事件,勾选连接点 2、如果需要对话框资源的话 “控件类型”选择“复合控件”,如果不需要选择“标准控件” 其他的默认就好,然后选择“完成” 三、在CeshiMain.h文件中找到类继承 public IPersistPropertyBagImpl<CeshiMain>//不然属性函数无法调用 1、在 BEGIN_COM_MAP(CeshiMain) COM_INTERFACE_ENTRY(IPersistPropertyBag)//在BEGIN_COM_MAP之间加上这句话,不然属性函数无法调用 END_COM_MAP() 2、//加上脚本安全属性,不然网页加载的时候无法加载 BEGIN_CATEGORY_MAP(CeshiMain) IMPLEMENTED_CATEGORY(CATID_SafeForScripting) IMPLEMENTED_CATEGORY(CATID_SafeForInitializing) END_CATEGORY_MAP() CeshiMain::CeshiMain() { m_bWindowOnly = TRUE;//在类初始化函数中添加,这句话很重要

MIDL changes the Interface name

眉间皱痕 提交于 2019-12-02 01:16:24
问题 I have a COM dll , which is consumed by .NET applications using COM Inter-op. In one of the CoClasses , there is an Interface called IT6TrackData and it has one get property called TrackData From the IDL file: Interface IT6TrackData { [propget, id(1)] HRESULT TrackData([out, retval] SAFEARRAY(BYTE) *pVal); } When the TLB file is viewed for the above IDL file, it shows the property as trackData ( t in lower case) For some reason the Client application were referring to this property as