导入类库
#include <atlcom.h>
#import "c:\atl3.dll" no_namespace, named_guids, raw_interfaces_only
-------------------------------------------------------------------------------------------------
::CoInitialize( NULL ); // 如果在这里进行 COM 初始化,要注意智能指针的释放
CComQIPtr <IMyTest> spFun;
HRESULT hr = spFun.CoCreateInstance( __uuidof(MyTest));
ATLASSERT( SUCCEEDED( hr ) );
spFun->Foo();
// spFun->Release(); // 大错特错!!!
spFun.Release(); // 正解
::CoUninitialize();
-------------------------------------------------------------------------------------------------