PC Review


Reply
Thread Tools Rate Thread

c# property exposed as COM bindable property

 
 
Miguel.Herrera@visy.com.au
Guest
Posts: n/a
 
      12th Oct 2005
I like to create an assembly with a property exposed in COM as
bindable. I have tried to use [Bindable(true)] attribute but when I
check the typelib produced by regasm for my assembly the property does
not have bindable on it.

Here is some code of what I mean:

[Bindable(true)]
public bool ActiveXDone
{
get
{
return _activeXDone;
}
set
{
_activeXDone = value;
}
}

when I use regasm to generate a typelib for my assembly I like to get
the following (note the bindable attribute):

[id(0x60020000), propget, bindable]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput, bindable]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);

but instead I get the following :

[id(0x60020000), propget]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);


What am I doing wrong ?

 
Reply With Quote
 
 
 
 
Dmytro Lapshyn [MVP]
Guest
Posts: n/a
 
      12th Oct 2005
Hi Miguel!

The [Bindable] attribute is for managed design-time environment, as far as I
know it has no effect on COM-visible type libraries.
I have looked through all System.Runtime.InteropServices attributes and it
seems there is no suitable attribute at all :-(.

Re-posting your question in microsoft.public.dotnet.framework.interop might
give better results.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I like to create an assembly with a property exposed in COM as
> bindable. I have tried to use [Bindable(true)] attribute but when I
> check the typelib produced by regasm for my assembly the property does
> not have bindable on it.
>
> Here is some code of what I mean:
>
> [Bindable(true)]
> public bool ActiveXDone
> {
> get
> {
> return _activeXDone;
> }
> set
> {
> _activeXDone = value;
> }
> }
>
> when I use regasm to generate a typelib for my assembly I like to get
> the following (note the bindable attribute):
>
> [id(0x60020000), propget, bindable]
> HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
> [id(0x60020000), propput, bindable]
> HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
>
> but instead I get the following :
>
> [id(0x60020000), propget]
> HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
> [id(0x60020000), propput]
> HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
>
>
> What am I doing wrong ?
>


 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      12th Oct 2005
Miguel,

You might have to reverse engineer some of the generated code to do
this. Offhand, I would create the TLB file, and then use OLEVIEW to view
the IDL.

Then, I would copy and paste the IDL into a new file, and add the
bindable attribute to the idl in the appropriate places. Once that is done,
I would run that IDL file through MIDL, and create a type library. Once you
do that, you should be able to register that type library to create your
CCW's.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I like to create an assembly with a property exposed in COM as
> bindable. I have tried to use [Bindable(true)] attribute but when I
> check the typelib produced by regasm for my assembly the property does
> not have bindable on it.
>
> Here is some code of what I mean:
>
> [Bindable(true)]
> public bool ActiveXDone
> {
> get
> {
> return _activeXDone;
> }
> set
> {
> _activeXDone = value;
> }
> }
>
> when I use regasm to generate a typelib for my assembly I like to get
> the following (note the bindable attribute):
>
> [id(0x60020000), propget, bindable]
> HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
> [id(0x60020000), propput, bindable]
> HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
>
> but instead I get the following :
>
> [id(0x60020000), propget]
> HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
> [id(0x60020000), propput]
> HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
>
>
> What am I doing wrong ?
>



 
Reply With Quote
 
Dmytro Lapshyn [MVP]
Guest
Posts: n/a
 
      13th Oct 2005
Nicholas,

I must say "live and learn" - I did not know before that one could create a
CCW from an already existing type library. Is there an example? What I
personally would try is creating a type library containing interfaces only,
then I'd run tlbimp.exe on it and create my [ComVisible] classes that
implement interfaces imported from the type library.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


"Nicholas Paldino [.NET/C# MVP]" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> Miguel,
>
> You might have to reverse engineer some of the generated code to do
> this. Offhand, I would create the TLB file, and then use OLEVIEW to view
> the IDL.
>
> Then, I would copy and paste the IDL into a new file, and add the
> bindable attribute to the idl in the appropriate places. Once that is
> done, I would run that IDL file through MIDL, and create a type library.
> Once you do that, you should be able to register that type library to
> create your CCW's.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - (E-Mail Removed)
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I like to create an assembly with a property exposed in COM as
>> bindable. I have tried to use [Bindable(true)] attribute but when I
>> check the typelib produced by regasm for my assembly the property does
>> not have bindable on it.
>>
>> Here is some code of what I mean:
>>
>> [Bindable(true)]
>> public bool ActiveXDone
>> {
>> get
>> {
>> return _activeXDone;
>> }
>> set
>> {
>> _activeXDone = value;
>> }
>> }
>>
>> when I use regasm to generate a typelib for my assembly I like to get
>> the following (note the bindable attribute):
>>
>> [id(0x60020000), propget, bindable]
>> HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
>> [id(0x60020000), propput, bindable]
>> HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
>>
>> but instead I get the following :
>>
>> [id(0x60020000), propget]
>> HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
>> [id(0x60020000), propput]
>> HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
>>
>>
>> What am I doing wrong ?
>>

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bindable property with options in drop down list? tombow Microsoft C# .NET 0 25th Apr 2007 01:33 AM
Adding a Bindable Property to an Web User Control Andrew Hayes Microsoft C# .NET 0 20th Nov 2006 11:06 AM
Visible Bindable Property - Eval code help Steve Microsoft ASP .NET 1 30th Sep 2006 09:00 AM
bindable property to extend the textbox Tommy Microsoft Dot NET Framework 0 5th Nov 2004 04:34 AM
create a bindable property Tommy Microsoft ASP .NET 0 4th Nov 2004 03:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:57 AM.