Hi All,
I am trying to use COM DLL in my C#.
I have added this DLL in referance and all interface are working fine.
I have one issue in calling function decleared like:
void SetSharedDirs(String Arrary* DirPaths);
For this function, C# is having the interop like:
public abstract new void SetSharedDirs ( System.Object pDirPaths )
Now i need to call this function from my C# program.
Below is the snapshot of my code. It throws exception as "Type Mismatch".
Can somebody help me out?
string[] sDirs = new string[]{"C:\\Program Files\\myApp\\Downloads"};
object objDirs = sDirs;
Share.SetSharedDirs(ref objDirs);
In this Share is the interface from DLL. All other functions in that
interface are working. But none of other functions having string array as
parameter.
Any help will be greatly appreciated.
Thanks,
Sudha. 6 5875
I am not sure but should the call Share.SetSharedDirs(ref objDirs);
need [ref] key word there?
--
Girish Bharadwaj http://msmvps.com/gbvb
"Sudha" <Su***@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com... Hi All,
I am trying to use COM DLL in my C#. I have added this DLL in referance and all interface are working fine.
I have one issue in calling function decleared like: void SetSharedDirs(String Arrary* DirPaths);
For this function, C# is having the interop like: public abstract new void SetSharedDirs ( System.Object pDirPaths )
Now i need to call this function from my C# program. Below is the snapshot of my code. It throws exception as "Type Mismatch". Can somebody help me out?
string[] sDirs = new string[]{"C:\\Program Files\\myApp\\Downloads"}; object objDirs = sDirs; Share.SetSharedDirs(ref objDirs);
In this Share is the interface from DLL. All other functions in that interface are working. But none of other functions having string array as parameter.
Any help will be greatly appreciated.
Thanks, Sudha.
Hi Girish,
Thanks for your reply.
Yes. "ref" is needed.
Actually while typing in my post, i missed "ref".
C# is having the interop like:
public abstract new void SetSharedDirs ( ref System.Object pDirPaths )
I am kind of stuck with this problem.... It will be great if you can help me
out.
Thanks.
"Girish Bharadwaj" wrote: I am not sure but should the call Share.SetSharedDirs(ref objDirs); need [ref] key word there?
-- Girish Bharadwaj http://msmvps.com/gbvb "Sudha" <Su***@discussions.microsoft.com> wrote in message news:A1**********************************@microsof t.com... Hi All,
I am trying to use COM DLL in my C#. I have added this DLL in referance and all interface are working fine.
I have one issue in calling function decleared like: void SetSharedDirs(String Arrary* DirPaths);
For this function, C# is having the interop like: public abstract new void SetSharedDirs ( System.Object pDirPaths )
Now i need to call this function from my C# program. Below is the snapshot of my code. It throws exception as "Type Mismatch". Can somebody help me out?
string[] sDirs = new string[]{"C:\\Program Files\\myApp\\Downloads"}; object objDirs = sDirs; Share.SetSharedDirs(ref objDirs);
In this Share is the interface from DLL. All other functions in that interface are working. But none of other functions having string array as parameter.
Any help will be greatly appreciated.
Thanks, Sudha.
Can you check out http://msdn.microsoft.com/library/de...gforarrays.asp
... It shows an array of strings (Safearray of strings to be exact) with the
following
HRESULT New([in] SAFEARRAY( BSTR ) ar);
to be having a managed signature of
void New( String [,] ar );
Do you think you can use a similar signature for your object?
--
Girish Bharadwaj http://msmvps.com/gbvb
"Sudha" <Su***@discussions.microsoft.com> wrote in message
news:D3**********************************@microsof t.com... Hi Girish,
Thanks for your reply.
Yes. "ref" is needed. Actually while typing in my post, i missed "ref". C# is having the interop like: public abstract new void SetSharedDirs ( ref System.Object pDirPaths )
I am kind of stuck with this problem.... It will be great if you can help
me out.
Thanks.
"Girish Bharadwaj" wrote:
I am not sure but should the call Share.SetSharedDirs(ref objDirs); need [ref] key word there?
-- Girish Bharadwaj http://msmvps.com/gbvb "Sudha" <Su***@discussions.microsoft.com> wrote in message news:A1**********************************@microsof t.com... Hi All,
I am trying to use COM DLL in my C#. I have added this DLL in referance and all interface are working fine.
I have one issue in calling function decleared like: void SetSharedDirs(String Arrary* DirPaths);
For this function, C# is having the interop like: public abstract new void SetSharedDirs ( System.Object pDirPaths )
Now i need to call this function from my C# program. Below is the snapshot of my code. It throws exception as "Type
Mismatch". Can somebody help me out?
string[] sDirs = new string[]{"C:\\Program Files\\myApp\\Downloads"}; object objDirs = sDirs; Share.SetSharedDirs(ref objDirs);
In this Share is the interface from DLL. All other functions in that interface are working. But none of other functions having string array
as parameter.
Any help will be greatly appreciated.
Thanks, Sudha.
Hi Girish,
I am new to C# and Interop. The COM DLL i am using is 3rd parties DLL.
Please correct me if i am wronge:
I have added that DLL in my C# project under "Referance".
It generats some interop files.
The link you gave explains how to marshall the paraments etc..
Do i need to marshall the interface and all of its functions?
How can i marshall only one function from one interface.
This COM dll is having lot of interfaces. And Each interface is having many
functions.
I am bit confused.
I appreciate your time.
Thanks.
"Girish bharadwaj" wrote: Can you check out http://msdn.microsoft.com/library/de...gforarrays.asp ... It shows an array of strings (Safearray of strings to be exact) with the following
HRESULT New([in] SAFEARRAY( BSTR ) ar);
to be having a managed signature of
void New( String [,] ar );
Do you think you can use a similar signature for your object? -- Girish Bharadwaj http://msmvps.com/gbvb "Sudha" <Su***@discussions.microsoft.com> wrote in message news:D3**********************************@microsof t.com... Hi Girish,
Thanks for your reply.
Yes. "ref" is needed. Actually while typing in my post, i missed "ref". C# is having the interop like: public abstract new void SetSharedDirs ( ref System.Object pDirPaths )
I am kind of stuck with this problem.... It will be great if you can help me out.
Thanks.
"Girish Bharadwaj" wrote:
I am not sure but should the call > Share.SetSharedDirs(ref objDirs); need [ref] key word there?
-- Girish Bharadwaj http://msmvps.com/gbvb "Sudha" <Su***@discussions.microsoft.com> wrote in message news:A1**********************************@microsof t.com... > Hi All, > > I am trying to use COM DLL in my C#. > I have added this DLL in referance and all interface are working fine. > > I have one issue in calling function decleared like: > void SetSharedDirs(String Arrary* DirPaths); > > For this function, C# is having the interop like: > public abstract new void SetSharedDirs ( System.Object pDirPaths ) > > Now i need to call this function from my C# program. > Below is the snapshot of my code. It throws exception as "Type Mismatch". > Can somebody help me out? > > string[] sDirs = new string[]{"C:\\Program Files\\myApp\\Downloads"}; > object objDirs = sDirs; > Share.SetSharedDirs(ref objDirs); > > In this Share is the interface from DLL. All other functions in that > interface are working. But none of other functions having string array as > parameter. > > Any help will be greatly appreciated. > > Thanks, > Sudha. > >
Did i ask anything silly??
"Sudha" wrote: Hi Girish,
I am new to C# and Interop. The COM DLL i am using is 3rd parties DLL. Please correct me if i am wronge: I have added that DLL in my C# project under "Referance". It generats some interop files.
The link you gave explains how to marshall the paraments etc.. Do i need to marshall the interface and all of its functions? How can i marshall only one function from one interface.
This COM dll is having lot of interfaces. And Each interface is having many functions.
I am bit confused.
I appreciate your time.
Thanks.
"Girish bharadwaj" wrote:
Can you check out http://msdn.microsoft.com/library/de...gforarrays.asp ... It shows an array of strings (Safearray of strings to be exact) with the following
HRESULT New([in] SAFEARRAY( BSTR ) ar);
to be having a managed signature of
void New( String [,] ar );
Do you think you can use a similar signature for your object? -- Girish Bharadwaj http://msmvps.com/gbvb "Sudha" <Su***@discussions.microsoft.com> wrote in message news:D3**********************************@microsof t.com... Hi Girish,
Thanks for your reply.
Yes. "ref" is needed. Actually while typing in my post, i missed "ref". C# is having the interop like: public abstract new void SetSharedDirs ( ref System.Object pDirPaths )
I am kind of stuck with this problem.... It will be great if you can help me out.
Thanks.
"Girish Bharadwaj" wrote:
> I am not sure but should the call > > Share.SetSharedDirs(ref objDirs); > need [ref] key word there? > > -- > Girish Bharadwaj > http://msmvps.com/gbvb > "Sudha" <Su***@discussions.microsoft.com> wrote in message > news:A1**********************************@microsof t.com... > > Hi All, > > > > I am trying to use COM DLL in my C#. > > I have added this DLL in referance and all interface are working fine. > > > > I have one issue in calling function decleared like: > > void SetSharedDirs(String Arrary* DirPaths); > > > > For this function, C# is having the interop like: > > public abstract new void SetSharedDirs ( System.Object pDirPaths ) > > > > Now i need to call this function from my C# program. > > Below is the snapshot of my code. It throws exception as "Type Mismatch". > > Can somebody help me out? > > > > string[] sDirs = new string[]{"C:\\Program Files\\myApp\\Downloads"}; > > object objDirs = sDirs; > > Share.SetSharedDirs(ref objDirs); > > > > In this Share is the interface from DLL. All other functions in that > > interface are working. But none of other functions having string array as > > parameter. > > > > Any help will be greatly appreciated. > > > > Thanks, > > Sudha. > > > > > > >
Look into this thread that went on in interop group. Your problem seems to
be very similar to what he ran into. He managed to solve it with
VariantWrapper. http://groups.google.com/groups?q=Je...phx.gbl&rnum=1
--
Girish Bharadwaj http://msmvps.com/gbvb
"Sudha" <Su***@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com... Hi Girish,
I am new to C# and Interop. The COM DLL i am using is 3rd parties DLL. Please correct me if i am wronge: I have added that DLL in my C# project under "Referance". It generats some interop files.
The link you gave explains how to marshall the paraments etc.. Do i need to marshall the interface and all of its functions? How can i marshall only one function from one interface.
This COM dll is having lot of interfaces. And Each interface is having
many functions.
I am bit confused.
I appreciate your time.
Thanks.
"Girish bharadwaj" wrote:
Can you check out http://msdn.microsoft.com/library/de...gforarrays.asp ... It shows an array of strings (Safearray of strings to be exact) with
the following
HRESULT New([in] SAFEARRAY( BSTR ) ar);
to be having a managed signature of
void New( String [,] ar );
Do you think you can use a similar signature for your object? -- Girish Bharadwaj http://msmvps.com/gbvb "Sudha" <Su***@discussions.microsoft.com> wrote in message news:D3**********************************@microsof t.com... Hi Girish,
Thanks for your reply.
Yes. "ref" is needed. Actually while typing in my post, i missed "ref". C# is having the interop like: public abstract new void SetSharedDirs ( ref System.Object
pDirPaths ) I am kind of stuck with this problem.... It will be great if you can
help me out.
Thanks.
"Girish Bharadwaj" wrote:
> I am not sure but should the call > > Share.SetSharedDirs(ref objDirs); > need [ref] key word there? > > -- > Girish Bharadwaj > http://msmvps.com/gbvb > "Sudha" <Su***@discussions.microsoft.com> wrote in message > news:A1**********************************@microsof t.com... > > Hi All, > > > > I am trying to use COM DLL in my C#. > > I have added this DLL in referance and all interface are working
fine. > > > > I have one issue in calling function decleared like: > > void SetSharedDirs(String Arrary* DirPaths); > > > > For this function, C# is having the interop like: > > public abstract new void SetSharedDirs ( System.Object pDirPaths ) > > > > Now i need to call this function from my C# program. > > Below is the snapshot of my code. It throws exception as "Type Mismatch". > > Can somebody help me out? > > > > string[] sDirs = new string[]{"C:\\Program
Files\\myApp\\Downloads"}; > > object objDirs = sDirs; > > Share.SetSharedDirs(ref objDirs); > > > > In this Share is the interface from DLL. All other functions in
that > > interface are working. But none of other functions having string
array as > > parameter. > > > > Any help will be greatly appreciated. > > > > Thanks, > > Sudha. > > > > > > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rob Mayo |
last post by:
How can I create a pointer to a string array from VB.Net? I want to take a
string array of variable size and pass it as a wParam on a message to a
custom subclassed window. I've tried wrapping the...
|
by: Ekim |
last post by:
hello,
I'm allocating a byte-Array in C# with byte byteArray = new byte;
Now I want to pass this byte-Array to a managed C++-function by reference,
so that I'm able to change the content of the...
|
by: Dennis Myrén |
last post by:
Hi.
I have an array of struct.
My question is, if i do:
STRUCT a = new STRUCT ;
STRUCT s = new STRUCT();
a = s;
since STRUCT is a value type, when assigning element 0 of the STRUCT array...
|
by: Chad Myers |
last post by:
I've been perf testing an application of mine and I've noticed that there
are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String
instances being created.
I've done some...
|
by: intrepid_dw |
last post by:
Hello, all.
I've created a C# dll that contains, among other things, two functions
dealing with byte arrays. The first is a function that returns a byte
array, and the other is intended to...
|
by: Lonewolf |
last post by:
Hi,
I'm not sure if this has been asked before so please pardon me if this
is a repeated question. Basically I have some performance critical
directshow codes which is implemented in native,...
|
by: mupe |
last post by:
Hi,
i have a problem with a Type Library, which is written in C++.
I am developing an application in C#.NET and have to use functions from
this COM-Type Library. When I use these functions in...
|
by: Boni |
last post by:
Dear all,
I have written a C++ COM object:
STDMETHOD(myfunc)(INT* array)
Now I need to pass an array from c# to COM. I generated a COM interop and
the signature of the function is
...
|
by: Arnshea |
last post by:
(apologies for the crosspost)
I'm working with an MFC based COM object. From C# I'd like to be able
to call a method on the COM object that takes a string array and
modifies the contents.
Is...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |