O'Reilly logo

Windows® CE 3.0 Application Programming by Marshall Brain, Nick Grattan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Smart Pointers

While it is quite straightforward to create and manage COM component objects using the techniques outlined in the preceding sections, bugs can easily be introduced if the AddRef and Release rules are not strictly followed. To alleviate this problem you can create "smart pointer" classes for interfaces, and these smart pointers automatically call AddRef and Release at the appropriate times.

Smart pointers are created using the _COM_SMARTPTR_TYPEDEF macro that is declared in the header file comdef.h. The macro is passed the following:

  • The class name declaring the interface functions. For example, you may use IPOutlookApp, and this interface is declared in pimstore.h.

  • The result of using the __uuidof macro, which is passed the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required