2010-12-04 27 views
1

Je crée un serveur COM en utilisant C++ Builder XE. Son ProgID est toujours 'PROGRAMNAME.CLASSNAME'.Réglage ProgID dans IDE

Comment puis-je changer le ProgID? Je souhaite utiliser 'COMPANYNAME.PROGRAMNAME.FUNCTIONALITY'.

Une réponse Delphi suffirait probablement.

Répondre

2

substituez la méthode GetProgID de l'usine. Quelque chose le long des lignes de ce qui suit devrait faire:

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) 
    { 
    } 
}; 

Puis ont le createFactory() du serveur COM utiliser l'usine dérivée.

Cheers,

Bruneau

+0

Merci, testeront dans la prochaine temps et cochez la réponse comme correcte si cela fonctionne. –