Hello. I've also posted this on the OT list, but since I didn't get an
answer, I though I'd give it a try here.

I'm building a component which is going to be consumed as an ActiveX
control. Since VB6 uses the interface ICategorizeProperties to get the
correct category for a property, I thought that I could implement that
interface so that I could build a more personalized component.

the problem i'm facing is related with this method:

HRESULT GetCategoryName (
   PROPCAT propcat,
   LCID lcid,
   BSTR *pbstrName
);

I've tried several signatures (using C#), but it seems that I can't
pass it correctly to VB6 (at least I see some strange characters
instead of the name of the category).

I've tried to build the method with this signature:

uint GetCategoryName (
   int PROPCAT,
   uint lcid,
   out string pbstrName
)
{
if( PROPCAT == PROPCAT_MyCat )
{
   pbstrName = "catName";
    return KnownHResults.S_OK; //same as S_OK for COM
}
}

And I also have tried this approach:

uint GetCategoryName (
   int PROPCAT,
   uint lcid,
   out IntPtr pbstrName
)
{
if( PROPCAT == PROPCAT_MyCat )
{
   pbstrName = Marshal.StringToBSTR( "catName" );
    return KnownHResults.S_OK; //same as S_OK for COM
}
}


Can anyone please give me some clues on what's wrong with this code? thanks.

--
Regards,
Luis Abreu
email: labreu_at_gmail.com
http://weblogs.pontonetpt.com/luisabreu
http://www.pontonetpt.com
http://weblogs.pontonetpt.com/

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

Essential .NET: building applications and components with CSharp
August 30 - September 3, in Los Angeles
http://www.develop.com/courses/edotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to