发生这种问题主要是没有将typelib信息写到注册表,只要调用RegisterTypeLibServer函数则可添加相关信息,参考下面代码。
以下宏定义是我为了简化com控件开发定义的。
//-----------------------------------------------------------------
//EXPORTS
//
//DllGetClassObject PRIVATE
//DllCanUnloadNow PRIVATE
//DllRegisterServer PRIVATE
//DllUnregisterServer PRIVATE
//-----------------------------------------------------------------
#pragma once
#include <assert.h>
#include <tchar.h>
#include <strsafe.h>
#include <Shlwapi.h>
#include "streams.h"
#include <atlbase.h>
#pragma comment(lib,"winmm.lib")
//Node:If you reference baseclass library,runtime library must use mt or mtd mode,because usually we compile baseclass in mt/mtd mode.
#if defined(DEBUG) || defined(_DEBUG)
#pragma comment(lib,"strmbasd.lib")
#else
#pragma comment(lib,"strmbas