all groups > dotnet interop > april 2004 >
You're in the

dotnet interop

group:

Problem: How to set a value to a property using IDispatch


Problem: How to set a value to a property using IDispatch dov_sheinker NO[at]SPAM yahoo.com (|
4/29/2004 7:48:03 AM
dotnet interop: Hi,
I got a problem here and would appreciate some help.

I have a System.__ComObject. I would like to get/set properties of
this COM object. I cast it to IDispatch, and using invoke() I'm able
to get properties' values.

Now I want to set a value, in order to do that, I need to set the
field rgvarg of System.Runtime.InteropServices.DISPPARAMS structure
with the value I want to set. The problem is that the rgvarg field is
IntPtr. Lets say the value I want to set is an integer/string how do I
convert an array of integer/string to IntPtr (I'm working in C#) ?

Re: Problem: How to set a value to a property using IDispatch Mattias Sjögren
4/29/2004 5:45:08 PM

To begin with, why are you using IDispatch directly at all, instead of
Type.InvokeMember()?



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Re: Problem: How to set a value to a property using IDispatch dov_sheinker NO[at]SPAM yahoo.com (|
5/2/2004 6:15:34 AM
Hi, Mattias.
Thanks alot for responding. I wasn't aware of Type.InvokeMember(). I
tried to use it and it worked quite well in both setting/getting
values.

I have another issue however, do you know how can I get the COM class
name ?

Thanks again.


[quoted text, click to view]
AddThis Social Bookmark Button