导入类库

#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();

-------------------------------------------------------------------------------------------------

相关文章:

  • 2021-09-27
  • 2021-12-01
  • 2021-08-10
  • 2021-07-13
  • 2021-09-16
猜你喜欢
  • 2021-11-28
  • 2021-08-03
  • 2021-09-18
  • 2021-06-17
  • 2021-11-02
相关资源
相似解决方案