atl

Add ATL Simple Object in Visual Studio 2017

余生颓废 提交于 2019-12-04 09:06:01
I am working with an old ATL/COM project in Visual Studio 2017. In previous versions of Visual Studio you could select "Add Class" and then select the option "Add simple ATL object" to add a COM class to the project. This option appears to be completely missing in Visual Studio 2017. Has the option been moved? Have I missed an installation option? Does Visual Studio fail to recognize my project as an ATL project? (It was created with a much older version.) Or is this the end of the road for ATL? I'm not sure whether this an answer, but it is too much for a comment and more than just an edit to

What's the fundamental difference between MFC and ATL?

泄露秘密 提交于 2019-12-04 07:22:05
问题 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

Is there a document on .rgs files syntax?

穿精又带淫゛_ 提交于 2019-12-04 04:54:10
Resource scripts loaded from .rgs files are used with ATL CComModule::UpdateRegistryFromResource() . It's quite common to see samples of such files on the net but I've never seen a complete description on what constructs are allowed in .rgs files. Is there such a document? There's some MSDN documentation , but it appears to be pretty unfocused. The book ATL Internals talks at some length about custom replacements. Other than that, I haven't seen much... 来源: https://stackoverflow.com/questions/1594283/is-there-a-document-on-rgs-files-syntax

how does the .RGS file works

烂漫一生 提交于 2019-12-04 03:28:29
In the .rgs file, there are some registry info, and I want to know how does the info in .rgs file added into regetry? I have a project AAA and it will generate the file AAA.DLL , and there is a file xxx.rgs which contains the registry info, and the AAA.DLL is built, then it will be deployed to another machine B, so I don't know how the registy info can be added on machine B, do I need register AAA.dll using regsvr32 command? Usually your code calls CComModule::UpdateRegistryFromResource() which in turn passes control to a special mechanism implemented in ATL which does the job - parses the

How does one return a local CComSafeArray to a LPSAFEARRAY output parameter?

a 夏天 提交于 2019-12-04 02:31:59
I have a COM function that should return a SafeArray via a LPSAFEARRAY* out parameter. The function creates the SafeArray using ATL's CComSafeArray template class. My naive implementation uses CComSafeArray<T>::Detach() in order to move ownership from the local variable to the output parameter: void foo(LPSAFEARRAY* psa) { CComSafeArray<VARIANT> ret; ret.Add(CComVariant(42)); *psa = ret.Detach(); } int main() { CComSafeArray<VARIANT> sa; foo(sa.GetSafeArrayPtr()); std::cout << sa[0].lVal << std::endl; } The problem is that CComSafeArray::Detach() performs an Unlock operation so that when the

How to best convert CString to BSTR to pass it as an “in” parameter into a COM method?

你。 提交于 2019-12-04 00:53:42
问题 I need to convert a CString instance into a properly allocated BSTR and pass that BSTR into a COM method. To have code that compiles and works indentically for both ANSI and Unicode I use CString::AllocSysString() to convert whatever format CString to a Unicode BSTR. Since noone owns the returned BSTR I need to take care of it and release it after the call is done in the most exception-safe manner posible and with as little code as possible. Currently I use ATL::CComBSTR for lifetime

Handling ATL/ActiveX events from within JavaScript

匆匆过客 提交于 2019-12-03 21:46:19
I have an ATL ActiveX control that raises three events (Connected, Authenticated, Disconnected) which need to be handled in IE/JavaScript. So far as I can tell, I'm doing everything right, specifically: (1) I've told ATL to implement the IProviderClassInfo2 interface, as described here . (2) I've implemented connection points within my ATL project by following the directions here . I now have a CProxy_IMyControlEvents class, with the appropriate Fire_Authenticated(), Fire_Connected() and Fire_Disconnected() implementations. They look more-or-less like this: template<class T> class CProxy

Firing a COM Event From Another Thread

99封情书 提交于 2019-12-03 21:03:36
I have created an in-process COM object (DLL) using ATL. Note that this is an object and not a control (so has no window or user-interface.) My problem is that I am trying to fire an event from a second thread and I am getting a 'Catastrophic failure' (0x8000FFFF). If I fire the event from my main thread, then I don't get the error. The second thread is calling CoInitializeEx but this makes no difference. I am using the Apartment threading model but switching to Free Threaded doesn't help. The fact I am trying to do this from a second thread is obviously crucial. Is there an easy way to do

Crash in CAtlStringMgr::GetInstance under Windows XP

孤街醉人 提交于 2019-12-03 16:57:54
I've written a DLL that creates an ATL CString object. I compile it with Visual Studio 2015 using the "Visual Studio 2015 - Windows XP (v140_xp)" platform toolset. The DLL is loaded using LoadLibrary/GetProcAddress. It crashes under Windows XP in CAtlStringMrg::GetInstance when allocating the string object. The same application works well on Windows Vista and later. Here is the disassembly: static IAtlStringMgr* GetInstance() { #pragma warning(push) #pragma warning(disable: 4640) static CWin32Heap strHeap( ::GetProcessHeap() ); 1003B100 mov eax,dword ptr fs:[0000002Ch] 1003B106 mov ecx,dword

How to write a shell extension in C++?

故事扮演 提交于 2019-12-03 15:33:22
问题 This seemed like a common question but after doing some searching, I wasn't really able to find my answers. There is an article on this here: http://www.codeproject.com/KB/shell/shellextguide1.aspx But it's for a very old version of Visual Studio. I'm using VS 2008, so the instructions and interfaces don't seem to match what I'm seeing. I want to create a simple shell extension using C++ that creates a context menu for files with extension .GZ. When right clicking on these files, I should be