atl

How to retrieve object pointer from ATL collection of objects?

限于喜欢 提交于 2019-12-11 17:51:57
问题 I have a collection of objects that is defined as: typedef IField ItemInterface; typedef CComObject<CField>* ItemClassPtr; typedef CAdapt< CComPtr<ItemInterface> > ItemType; typedef std::vector< ItemType > ContainerType; and I have created several of the CField objects via a series of calls (ignoring hresult): IField* ppField = 0; hresult = CField::CreateInstance(&ppField); ItemType spField = ppField; m_coll.push_back(spField); ppField->Release(); and now I'm trying to retrieve a pointer to

What's the purpose of IUnknown member functions in END_COM_MAP?

左心房为你撑大大i 提交于 2019-12-11 15:18:35
问题 ATL END_COM_MAP macro is defined as follows: #define END_COM_MAP() \ __if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr }, }\ {NULL, 0, 0}}; return _entries;} \ virtual ULONG STDMETHODCALLTYPE AddRef( void) throw() = 0; \ virtual ULONG STDMETHODCALLTYPE Release( void) throw() = 0; \ STDMETHOD(QueryInterface)(REFIID, void**) throw() = 0; It is intended to be used within definition of classes inherited from COM interfaces, for example: class ATL_NO_VTABLE CMyClass :

Can't get simple COM project to work: where and how to put implementation?

情到浓时终转凉″ 提交于 2019-12-11 15:13:57
问题 I am trying to follow the steps of a Simple COM Tutorial which looks nice and logical to me. I would normally shy away from using a wizard but consensus seems to be this is the best way to do COM. To summarize Create an ATL project with the wizard Use the Add Class dialog to create an ATL simple object ( SimpleChatServer in the example) Navigate into ClassView, right click the interface for the object, Add Method ( CallMe in the example) The tutorial gives a method body to use Compile My

Advantages & Disadvantages of writing IE addons in .NET

若如初见. 提交于 2019-12-11 15:13:33
问题 Since i am a .NET developer, I am planning to write a IE addon in .NET. Does anyone here have experience with/in developing IE extensions in .NET that can share their knowledge? Specifically i like to know about advantages & disadvantages of using .NET for this task in comparison to ATL COM. 回答1: I'd rather say that advantages & disadvantages are not bound to IE addons but more to the programming languages and their platforms. .NET: It is easier and more safe then C++ Easy to create and

Custom draw CProgressBarCtrl win32

旧时模样 提交于 2019-12-11 11:14:47
问题 I want to have a custom progress bar control, for example showing some moving oblique lines or like this or drawing an image inside the progress bar control. I 've searched the web and some examples of custom drawing for listviews and dynamic subclassing but the code doesn't call the painting methods: public: BOOL SubclassWindow(HWND hWnd) { ATLASSERT(m_hWnd==NULL); ATLASSERT(::IsWindow(hWnd)); BOOL bRet = CWindowImpl<CMyProgressControl, CProgressBarCtrl>::SubclassWindow(hWnd); return bRet; }

How can the caller's process be identified in an ATL COM+ out-of-proc server application?

荒凉一梦 提交于 2019-12-11 11:14:38
问题 I have an ATL service running as an out-of-proc server that has several COM classes that the clients are expected to be using. Because of a change in requirements, I need to be able to identify which process owns which instances of the objects. I'm trying to use some of the COM functions to find out this information but I can't find the right ones. CoGetCallContext only returns information about the user who called the method, not which process it came from. Same with CoQueryClientBlanket .

TAB control background in ATL App, XP styles

久未见 提交于 2019-12-11 09:28:56
问题 I have an ATL application with a dialog containing a TAB control. The App uses a common controls manifest. Under XP with visual styles, the tab control background is a different color than the dialog and the controls (mostly checkboxes), so it looks quite ugly. Screenshot How can I fix that? 回答1: Here you could find answer to your question. 回答2: There is - apparently - one thing to do to get tab control pages colored correctly using XP visual styles. In the WM_INITDIALOG handler for each page

OLEDB - C++ - ATL's OLEDB Provider sample crashes Excel (uncaught exception from msado15.dll)

微笑、不失礼 提交于 2019-12-11 08:37:58
问题 I have compiled the Sample OleDb Provider code which comes from running the VS2007 ATL OLEDB Provider wizard. I have given fuller details on that blog post. The code crashes Excel. Sub TestOleDbProvider() On Error GoTo ErrHand Dim cn As ADODB.Connection Set cn = New ADODB.Connection cn.Open "Provider=FindFiles;Server=foo;Database=bar" '* this works Dim cmd As ADODB.Command Set cmd = New ADODB.Command Set cmd.ActiveConnection = cn '* this works cmd.CommandText = "*.*" '* this works Stop Dim rs

How to copy a CImage object?

元气小坏坏 提交于 2019-12-11 07:57:52
问题 I am trying to copy a CImage so that I can do some manipulation with it's pixels. I've tried this where source is a pointer to a loaded CImage object. CImage* dest = new CImage(*source); However this doesn't seem to work and I believe source and dest are pointing to the same memory. How would I create a new copy totally detached from the previous CImage? 回答1: If this is a question about MFC/ATL CImage then you can create new instance and use Create to initialize it to the size of the original

ATL COM 32-bit dll to 64-bit non-COM dll

梦想与她 提交于 2019-12-11 07:57:39
问题 I have a 32-bit dll library project written in C++ ATL COM. How do you convert a ATL COM project to pure C++ non-COM 64-bit? I believe ATL COM, or COM, doesn't support 64-bit. Are there any instructions/guidelines on how to strip away the ATL COM part of such a project and replace it with managed or unmanaged C++, so it's compile able to 64-bit? Best Regards, Johan 来源: https://stackoverflow.com/questions/52702542/atl-com-32-bit-dll-to-64-bit-non-com-dll