|
|
|
start date: Mon, 2 Jul 2007 16:12:14 +0530,
posted on: microsoft.public.dotnet.framework.interop
back
| Thread Index |
|
1
kris
|
|
2
G Himangi
|
|
3
kris
|
COM Interop
Hi ,
I am trying to reference a COM dll ( x.dll) from my C# code.
I have to do this programatically at runtime and access its functions.
( Not through Project-->Add Reference->COM-------etc that we do through
visual studio).
Can anyone help me , how i can do this.
Regards
Kris
Date:Mon, 2 Jul 2007 16:12:14 +0530
Author:
|
Re: COM Interop
Its possible to do this via late-binding if your COM object supports
Automation.
Then you can use :
Type appType = Type.GetTypeFromProgID("Your COM PROGID");
instance = Activator.CreateInstance(appType);
After this, use Reflection to invoke the methods/properties of the COM
object ('instance')
---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------
"kris" wrote in message
news:%235PzkXJvHHA.3588@TK2MSFTNGP06.phx.gbl...
> Hi ,
>
> I am trying to reference a COM dll ( x.dll) from my C# code.
> I have to do this programatically at runtime and access its functions.
> ( Not through Project-->Add Reference->COM-------etc that we do through
> visual studio).
> Can anyone help me , how i can do this.
>
> Regards
> Kris
>
>
>
>
Date:Tue, 3 Jul 2007 17:10:06 +0530
Author:
|
Re: COM Interop
Hi Himangi,
I am facing with some problems when i say Activator.CreateInstance(appType);
When i am calling this function , i need to cast the object to some class
name in my component.
Because i am not referencing this component anywhere in my program , i am
getting a compile time error saying
"The type or namespace name could not found , are you missing some
reference."
check the code statement below.
MyClass instance = (MyClass)Activator.CreateInstance(appType);
//if the above line succeeds , then i will call a function as below.
//instance.SomeMethod()
Can you please suggest me on this.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> Type appType = Type.GetTypeFromProgID("Your COM PROGID");
> instance = Activator.CreateInstance(appType);
> After this, use Reflection to invoke the methods/properties of the COM
> object ('instance')
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Thanks & Regards
Kris
"G Himangi" wrote in message
news:OE288ZWvHHA.4736@TK2MSFTNGP05.phx.gbl...
> Its possible to do this via late-binding if your COM object supports
> Automation.
>
> Then you can use :
>
> Type appType = Type.GetTypeFromProgID("Your COM PROGID");
> instance = Activator.CreateInstance(appType);
> After this, use Reflection to invoke the methods/properties of the COM
> object ('instance')
>
> ---------
> - G Himangi, Sky Software http://www.ssware.com
> Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
> Browsing Functionality For Your App (.Net & ActiveX Editions).
> EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
> EZShellExtensions.Net : Develop all shell extensions,explorer bars and
> BHOs rapidly in .Net
> ---------
>
>
>
>
>
> "kris" wrote in message
> news:%235PzkXJvHHA.3588@TK2MSFTNGP06.phx.gbl...
>> Hi ,
>>
>> I am trying to reference a COM dll ( x.dll) from my C# code.
>> I have to do this programatically at runtime and access its functions.
>> ( Not through Project-->Add Reference->COM-------etc that we do through
>> visual studio).
>> Can anyone help me , how i can do this.
>>
>> Regards
>> Kris
>>
>>
>>
>>
>
>
Date:Wed, 4 Jul 2007 11:06:50 +0530
Author:
|
|
|