|
-
October 6th, 2005, 09:46 AM
#1
c# and variant types
Hey all.
I have this COM server and a method on it takes a variant type, how can i declare a pass a variant in c#?
-
October 6th, 2005, 10:10 AM
#2
Re: c# and variant types
What does tlbimp.exe have to say about the dll ? Add the dll as a reference to your project and see what the wrapper class does.
Darwen.
-
October 6th, 2005, 10:26 AM
#3
Re: c# and variant types
A COM VARIANT type (as well as IUnknown* and IDispatch*) is marshalled as a System.Object. Say you have a function like this
Code:
HRESULT Open(
[in] VARIANT* FileName,
[in] VARIANT options);
Then you can do it like this:
Code:
object fileName = @"c:\test.txt";
object options = 0; // some flags
Open(ref fileName, options);
The COM attribute/C# modifier table is :
Code:
[in] - > <no_modifier>
[out] - > out
[in, out] - > ref
[out, retval] - > <return_value>
See this link http://msdn.microsoft.com/library/de...forobjects.asp for more.
-
October 6th, 2005, 10:42 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|