// include necessary headers #include#include #include int main() { // create an FdoPtr object FdoPtr ptrGeometry = FdoGeometryFactory::CreateGeometry(FdoGeometryType_LineString); // use the managed CGeometry object FdoGeometryFactory::CreatePoint(ptrGeometry, 0.0, 0.0); // the object is automatically released when it goes out of scope // no need to manually delete the pointer return 0; }
// include necessary headers #includeIn this example, we use `FdoPtr` to manage a COM object (`IXMLDOMDocument2`). The `pXMLDoc` object is automatically released when the `FdoPtr#include int main() { // initialize COM CoInitialize(NULL); // create an FdoPtr object to manage a COM object FdoPtr pXMLDoc; CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument2, (void**)&pXMLDoc); // use the managed COM object pXMLDoc->loadXML(L" "); // release COM object pXMLDoc.Release(); // uninitialize COM CoUninitialize(); return 0; }