atl

Getting Outlook::_MailItem from Outlook::Attachment (embedded email)

I'm writing an Outlook Addin using VC/ATL. This particular addin takes selected email messages and writes them to disk. It also writes all of the associated attachments to disk. We then read everything in to our application outside of Outlook. Using the Outlook object model, this is pretty straightforward as both _MailItem and Attachmen...

Icon on toolbar is not transparent

We have created an IE toolbar. we are displaying an icon on toolbar by using a static control and keeping image over it. as this static control is not transparent so this icon is displaying some backgroud color(this is default color of windows common controls). is it possible to make the static control as transparent irrespective of br...

CoCreateInstance for EnvDTE without an AddRef()?

This is somewhat related to another question that I've asked that I've pretty much figured out. The last piece of the puzzle is using CoCreateInstance() instead of GetActiveObject(). I don't want to use an existing instance of EnvDTE, so I call CoCreateInstance, which properly fires off a new instance of VisualStudio. CoCreateInstance() ...

Xml output parameter in OLEDB?

I have a sproc which looks like that: CREATE PROCEDURE xyz ( @param1 int, @param2 int, @param3 xml OUTPUT ) I'm trying to access it using OLEDB: DEFINE_COMMAND_EX( Accessor, _T( "{ ? = CALL xyz( ?,?,? ) }" ) ) BEGIN_PARAM_MAP( Accessor ) SET_PARAM_TYPE(DBPARAMIO_OUTPUT) COLUMN_ENTRY(1, _result) SET_PARAM_TYPE(DBPARAMIO_INPUT) COL...

COM Error 0x80004003 (Invalid Pointer) access MS Outlook contacts

I am some ATL code that uses smart COM pointers to iterate through MS Outlook contacts, and on some PC's I am getting a COM error 0x80004003 ('Invalid Pointer') for each contact. The same code works fine on other PCs. The code looks like this: _ApplicationPtr ptr; ptr.CreateInstance(CLSID_Application); _NameSpacePtr ns = ptr->GetName...

Resolve a COM [out] VARIANT* containing parray as SAFEARRAY of BSTR's in c#.net

Question: I have a COM server with a method as IDL: [id(2), helpstring("method ExtractAvailableScanners")] HRESULT ExtractAvailableScanners( [in] VARIANT scanFilter, [out] VARIANT* scanPresent, [out,retval] LONG* retVal); In the header file this becomes: STDMETHOD(ExtractAvailableScanners) (VAR...

"class not registered" which class?

Consider this code: try { ISomeObject pObj(__uuidof(SomeClass)); ISomeObject pObj2(__uuidof(SomeOtherClass)); } catch ( _com_error& e ) { // Log what failed } I.e. I have a block of code which instanciates my objects. Sometimes (a bad install) it failes because some class wasn't properly registered. (I don't have a partic...

Using CList in a multithreaded environment

I am using a CList in a multithreaded environment and I keep having problem with the GetHead method. I have one thread that add data to the list, and an other thread who read and remove data from the list. Here is the reading part : value_type get_next() { T t; if(!queue.IsEmpty()) { t = queue...

Unable to get ATL Connection Points working...

I am trying to create a COM component using ATL, and I'd like to raise events for my VB client. I've found numerous tutorials, all of which seem to vary in details, and none of them appear to generate a working solution. Here is what I am doing: (Using Visual Studio 2008): Create a new ATL DLL Project. I've called it ATLEventTest. C...

ATL Server Web Service on Windows Vista and VS2005

Hi There !!! Let's find someone who could help me on this problem. I have created on VS2005 under Windows Vista a new Visual C++ ATL Server Web Service Project with: Blob Cache Session Services (Memory-backed session-state service) I compiled the project sucessfully. Then, i opened IExplorer and access de URL to generate the WSDL. The W...

Creating ATL Server Web Service with VS 2005 Wizard and CLR option doesn't works on Vista/IIS7

Hi There! I created a ATL Server Web Service With Visual Studio 2005 Wizard and chanded the project settings to support CLR:oldSyntax. Generating WSDL Web Service and consuming it works fine on XP width IIS 5.1. On Vista with IIS 7, only works fine when i compile the project without CLR option. With the CLR, the WSDL isn't generated. I ...

SetThreadLocale and UTF8

So I want to use SetThreadLocale to set a threads codepage to UTF8. Up to now, I've been using the second parameter of atl string conversion macros like "CT2A(szBUF, CP_UTF8)" to do this. But I want to be able to set the thread codepage once in the beginning with SetThreadLocale() and never have to use the second parameter of the conver...

Compilation errors through incorrect use of CComPtr objects

I have defined the following CComPtr object and method in my class: private: CComPtr<IRawPdu>& getRawPdu(); // Returns the RawPdu interface pointer from the mRawPdu data member. // mRawPdu is initialized, if necessary. CComPtr<IRawPdu> mRawPdu; // Initialized to 0 in the ctor. Uses lazy evaluation via getRawPdu()....

How can I return both an error string and error code to VB6 from an ATL activex control?

I'm trying to return a detailed error to VB6 using CComCoClass::Error, but it seems I can only return an error code /or/ a message - but not both. return Error(_T("Not connected"), __uuidof(IMyInterface), HRESULT_FROM_WIN32(ERROR_CONNECTION_INVALID)); results in a generic "Method 'Request' of object 'IMyInterface' failed" error messag...

COM MFC ATL worth studying??

Is it worth studying COM MFC ATL WTL now? ...

Using MSHTML ATL Whats the best way to highlight parts of a web page?

Wanting to highlight stuff in web pages as you mouse over, but there seem to be so many ways you can set display properties I'm having trouble finding a good way to change the display so that it can change back and still keep close to what the user was already looking at. The IE 8 developer tools Outline tool does something like what I ...

CA2W gave me a "'AtlThrowLastWin32': identifier not found" error

I got a strange compilation error when I followed the MSDN document to use CA2W to convert big5 strings to unicode strings in Visual Studio 2005. This is the code I wrote: #include <string> #include <atldef.h> #include <atlconv.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string chineseInBig5 = "\xA4\xA4\xA4\x...

ATL, VS2008 extenson: Adding event handler to WindowEvents

Used the New Add-in Wizard to create a Visual C++ / ATL add-in project. Generated code: HRESULT hr = S_OK; pApplication->QueryInterface(__uuidof(DTE2), (LPVOID*)&m_pDTE); pAddInInst->QueryInterface(__uuidof(AddIn), (LPVOID*)&m_pAddInInstance);` Get the Events object, and the WindowEvents: m_pDTE->get_Events(&m_pEvents); m...

add custom context menu to hosted web browser control

I am hosting a web browser control, and want to provide my own context menu. Ideally, I want to present my own context menu, that contains the original browser's context menu (with all addins etc.) as a sub menu. If that's not possible / to tricky, I'd be ok with e.g. normally showing my context menu, and showing the original one when ...

handle keyboard events / shortcuts in hosted web browser control

I am hosting a web browser control, and I don't know how to fetch hotkeys such as [F1] when the control has focus. My primary need is displaying custom help when the user presses F1, however, generally being able to provide additionla shortcuts would be nice. (additional information is available at my related question - I hope it was t...