我正在使用C++生成器XE创建COM服务器。它的ProgID始终是'PROGRAMNAME.CLASSNAME‘。
如何更改ProgID?我想使用‘COMPANYNAME.PROGRAMNAME.FuncIONALITY’。
Delphi的答案可能就足够了。
发布于 2010-12-05 07:57:10
重写工厂的GetProgID方法。下面的内容应该是这样的:
template <typename T>
class TMyCppComObjectFactory : public TCppComObjectFactory<T>
{
protected:
System::UnicodeString __fastcall GetProgID()
{
return "Company.ProgName.Functionality";
}
public:
__fastcall TMyCppComObjectFactory(Comobj::TComServerObject* ComServer,
Comobj::TComClass ComClass,
const GUID &ClassID,
const System::String ClassName,
const System::String Description,
Comobj::TClassInstancing Instancing,
Comobj::TThreadingModel ThreadingModel) :
TCppComObjectFactory<T>(ComServer, ComClass, ClassID,
ClassName, Description,
Instancing, ThreadingModel)
{
}
};然后让COM服务器的createFactory()使用派生工厂。
干杯,
布鲁诺
https://stackoverflow.com/questions/4351458
复制相似问题