locked
Implemented Categories RRS feed

  • Question

  • Anyone know how to add implemented categories when registering a C# Com dll?

    Regasm add the following CATID: {62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}

    What I'm looking for is to add a second CATID as the application that I am creating the COM component for needs this catid before it will load my dll.

    I can create a regfile and add this implemented category to the bottom of the file but I do not want to do this on every machine that I register the component on.

    David

    Thursday, September 27, 2012 3:50 PM

Answers

  • Hello David,

    1. One good way of accomplishing your goal is to use the ComRegisterFunctionAttribute and the ComUnregisterFunctionAttribute.

    2. Please refer to : "Perform Custom Action during Registration of a Managed COM Server" for sample code :

    https://limbioliong.wordpress.com/2011/08/30/adding-additional-data-when-registering-c-com-servers/

    - Bio.


    Please visit my blog : http://limbioliong.wordpress.com/

    • Proposed as answer by Lisa Zhu Monday, October 1, 2012 6:24 AM
    • Marked as answer by Lisa Zhu Thursday, October 4, 2012 9:13 AM
    Thursday, September 27, 2012 5:06 PM
  • You'll need to register and unregister the categories manually by defining the corresponding functions and using ComRegisterFunctionAttribute.  Within your function(s) you'll use the standard registry API to add and remove the categories you support.  I was thinking that at one point someone created a custom attribute you could apply to your COM classes but you'd still need the custom register/unregister functions to get it to work.

    Michael Taylor - 9/27/2012
    http://msmvps.com/blogs/p3net

    • Proposed as answer by Lisa Zhu Monday, October 1, 2012 6:23 AM
    • Marked as answer by Lisa Zhu Thursday, October 4, 2012 9:13 AM
    Thursday, September 27, 2012 5:14 PM

All replies

  • I found this webpage at msdn but it only supplies the C++ interface

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms692843(v=vs.85).aspx

    Pinvoke does have code at this link

    http://www.pinvoke.net/default.aspx/Interfaces/ICatRegister.html


    jdweng

    Thursday, September 27, 2012 4:56 PM
  • Hello David,

    1. One good way of accomplishing your goal is to use the ComRegisterFunctionAttribute and the ComUnregisterFunctionAttribute.

    2. Please refer to : "Perform Custom Action during Registration of a Managed COM Server" for sample code :

    https://limbioliong.wordpress.com/2011/08/30/adding-additional-data-when-registering-c-com-servers/

    - Bio.


    Please visit my blog : http://limbioliong.wordpress.com/

    • Proposed as answer by Lisa Zhu Monday, October 1, 2012 6:24 AM
    • Marked as answer by Lisa Zhu Thursday, October 4, 2012 9:13 AM
    Thursday, September 27, 2012 5:06 PM
  • You'll need to register and unregister the categories manually by defining the corresponding functions and using ComRegisterFunctionAttribute.  Within your function(s) you'll use the standard registry API to add and remove the categories you support.  I was thinking that at one point someone created a custom attribute you could apply to your COM classes but you'd still need the custom register/unregister functions to get it to work.

    Michael Taylor - 9/27/2012
    http://msmvps.com/blogs/p3net

    • Proposed as answer by Lisa Zhu Monday, October 1, 2012 6:23 AM
    • Marked as answer by Lisa Zhu Thursday, October 4, 2012 9:13 AM
    Thursday, September 27, 2012 5:14 PM