atl

MIDL changes the Interface name

百般思念 提交于 2019-12-01 21:28:20
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 trackData and everything was working fine until now. As part of enhancement the above Interface was upgraded

Handling CoCreateInstance return value

别等时光非礼了梦想. 提交于 2019-12-01 19:00:54
Here's a code sample creating a COM object: CComPtr<IBaseFilter> pFilter; auto hr = CoCreateInstance(CLSID_DMOWrapperFilter, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, reinterpret_cast<void**>(&pFilter)); I've seen somewhere that checking if CoCreateInstance() succeeded should look like this: if (SUCCEEDED(hr) && pFilter != nullptr) { // code goes here } What if I would check only hr ? Wouldn't it be enough? Should I also check that filter != nullptr ? //would this be enough? if (SUCCEEDED(hr)) { // code goes here } This question also concerns other COM methods like QueryInterface() . Having

How do I convert an ATL/MFC CString to a QString?

独自空忆成欢 提交于 2019-12-01 18:00:30
Given the encoding of the project is probably Unicode (but not for sure) what is the best way of converting ATL::CString to QString? What I have thought of is this: CString c(_T("SOME_TEXT")); //... std::basic_string<TCHAR> intermediate((LPCTSTR)c); QString q; #ifdef _UNICODE q = QString::fromStdWString(intermediate); #else q = QString::fromStdString(intermediate); #endif Do you think that it works? Any other ideas? You don't need the intermediate conversion to a std::string . The CString class can be treated as a simple C-style string; that is, an array of characters. All you have to do is

Compiler Errors in atlwin.h

时光毁灭记忆、已成空白 提交于 2019-12-01 13:08:32
When including atlwin.h from the Microsoft ATL libraries in Visual Studio 2013 building will result in numerous complier errors about undefined elements. i.e. #include <atlwin.h> class MainWnd : public CWindowImpl<MainWnd> {}; "CWindowImpl: base class is not defined" error. or HMONITOR is not defined This does not occur when building using VS2010. How can I fix that? The problem is with the targeted version of windows in the stdafx.h file from MSDN Visual C++ no longer supports targeting Windows 95, Windows 98, Windows ME, or Windows NT. If your WINVER or _WIN32_WINNT macros are assigned to

Accessing body (at least some data) in a iframe with IE plugin Browser Helper Object (BHO)

我是研究僧i 提交于 2019-12-01 12:11:54
问题 I'm developing an IE8+ BHO plugin. For now I'm simply trying to insert a text into an iframe (class="Al Ai Editable") contained in another iframe (id="canvas_frame") . I managed to obtain the IHTMLElement of the iframe i want to add text to (the class="Al Ai editable"). I can prove this by the fact that the el variable which is of type IHTMLElement : el->get_className(&cl); //Al Ai editable is correctly displaying the class of the iframe in the MessageBox. The problem i have now is that i can

Compiler Errors in atlwin.h

拟墨画扇 提交于 2019-12-01 11:21:38
问题 When including atlwin.h from the Microsoft ATL libraries in Visual Studio 2013 building will result in numerous complier errors about undefined elements. i.e. #include <atlwin.h> class MainWnd : public CWindowImpl<MainWnd> {}; "CWindowImpl: base class is not defined" error. or HMONITOR is not defined This does not occur when building using VS2010. How can I fix that? 回答1: The problem is with the targeted version of windows in the stdafx.h file from MSDN Visual C++ no longer supports targeting

Why would Windows Search query my IFilter for a bunch of weird interfaces?

旧巷老猫 提交于 2019-12-01 10:35:36
I've implemented an IFilter as a native VC++ ATL in-proc COM server. Windows Search wouldn't use it - it creates an instance of my IFilter and then executes a bunch of QueryInterface() calls, specifically: IMarshal IStdMarshalInfo something with {4C1E39E1-E3E3-4296-AA86-EC938D896E92} interface id and a couple of others. Since my IFilter only implements IFilter, IPersist and IPersistFile most of the calls return E_NOINTERFACE, so Windows Search just releases my object and does nothing. Why is it querying for those interfaces and how do I work the problem around? Shay Erlichmen Windows tries

Why would Windows Search query my IFilter for a bunch of weird interfaces?

血红的双手。 提交于 2019-12-01 08:45:25
问题 I've implemented an IFilter as a native VC++ ATL in-proc COM server. Windows Search wouldn't use it - it creates an instance of my IFilter and then executes a bunch of QueryInterface() calls, specifically: IMarshal IStdMarshalInfo something with {4C1E39E1-E3E3-4296-AA86-EC938D896E92} interface id and a couple of others. Since my IFilter only implements IFilter, IPersist and IPersistFile most of the calls return E_NOINTERFACE, so Windows Search just releases my object and does nothing. Why is

Converting _TCHAR* to char*

久未见 提交于 2019-12-01 05:45:29
I'm trying to get a simple OpenCV sample working in C++ on Windows and my C++ is more than rusty. The sample is fairly simple: #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main( int argc, char** argv ) { if( argc != 2) { cout <<" Usage: display_image ImageToLoadAndDisplay" << endl; return -1; } Mat image; image = imread(argv[1], IMREAD_COLOR); // Read the file if(! image.data ) // Check for invalid input { cout << "Could not open or find the image" << std::endl ; return -1; } namedWindow( "Display

Marshalling BSTRs from C++ to C# with COM interop

别等时光非礼了梦想. 提交于 2019-12-01 04:25:37
I have an out-of-process COM server written in C++, which is called by some C# client code. A method on one of the server's interfaces returns a large BSTR to the client, and I suspect that this is causing a memory leak. The code works, but I am looking for help with marshalling-out BSTRs. Simplifying a bit, the IDL for the server method is HRESULT ProcessRequest([in] BSTR request, [out] BSTR* pResponse); and the implementation looks like: HRESULT MyClass::ProcessRequest(BSTR request, BSTR* pResponse) { USES_CONVERSION; char* pszRequest = OLE2A(request); char* pszResponse = BuildResponse