Sometimes you need to debug your QueryInterface implementation. Maybe you're building a custom COM_MAP macro. Maybe you're seeing weird behavior on some interfaces. Sometimes the easiest way to track down a problem is in the debugger. This is where COM_INTERFACE_ENTRY_BREAK comes in:

#define COM_INTERFACE_ENTRY_BREAK(x) \   { &_ATL_IIDOF(x), NULL, _Break },    

The _Break function outputs some helpful debugging information and calls DebugBreak:

static HRESULT WINAPI                                          CComObjectRootbase::_Break(void*, REFIID iid, void**, DWORD) {   (iid);                                                       _ATLDUMPIID(iid, _T("Break due to QI for interface "), S_OK);    DebugBreak();                                                  return S_FALSE;                                              }                                                              

The call to DebugBreak is just like a breakpoint set in your debugger. It gives the active debugger the chance to take control of the process. When you're debugging, you can set other breakpoints and continue executing.

ATL Internals. Working with ATL 8
ATL Internals: Working with ATL 8 (2nd Edition)
ISBN: 0321159624
EAN: 2147483647
Year: 2004
Pages: 172

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: