SafeRelease
Many of the code examples in this documentation use the following function to release COM interface pointers.
template <class T> void SafeRelease(T **ppT)
{
if (*ppT)
{
(*ppT)->Release();
*ppT = NULL;
}
}
Note
This function is not defined in an SDK header. To use this function, you must define it in your own code.
This function releases the pointer ppT and sets it equal to NULL.
Another option is to use a smart pointer class, such as CComPtr, which is defined in the Active Template Library (ATL).
Related topics
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin