Setting ProgID in IDE
I am creating a COM server using C++ Builder XE. Its ProgID is alw开发者_StackOverflow社区ays 'PROGRAMNAME.CLASSNAME'.
How do I change the ProgID? I want to use 'COMPANYNAME.PROGRAMNAME.FUNCTIONALITY'.
A Delphi answer would probably suffice.
Override the GetProgID method of the factory. Something along the lines of the following should do:
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)
{
}
};
Then have the createFactory() of the COM Server use the derived factory.
Cheers,
Bruneau
精彩评论