Does anyone know of a sample showing use (sinking?) of an event by a client using #import but not ATL?
I have tried to search, but unfortunately search engines don't recognize the # in #import. Also I don't know how to navigate the articles in this web site to find the relevant articles and as I said searching does not help. I find samples that don't use #import and I find samples that use ATL and/or MFC, but as I recall MFC does not help much for COM stuff that it does not have support for in the MFC libraries.
Yes, it has been a few years since I was in these forums. I was the first to get 10,000 posts, nearly all attempts to help others. I hope I can get some guidance now.
Attached please find the sample of handling COM events. The sample includes a trivial COM server which fires event back on calling COM method. The client uses no ATL features for implementing event sink, just regular COM smartpointers.
Last edited by Igor Vartanov; May 27th, 2011 at 04:09 AM.
Please also take into account, the sample does not provide complete error handling for the sake of code simplicity. And in a real project every _ASSERT(SUCCEEDED(hr)) has to be turned to if (SUCCEEDED/FAILED(hr)) clause.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.