stcheng
Thu Jul 24 22:20:18 CDT 2008
Hi Philippe,
Some community member and I have replied you in the following thread:
#SUBJECT: Using an ActiveX in a Web service
NEWSGROUP: microsoft.public.dotnet.framework.aspnet
Is this thread the same issue with that thread? Based on that thread, I
think you've got the out-process COM component to created correctly in your
webservice code, correct?
For creating COM instance in .NET application(no matter in-process or
out-process), you can use the later minding approach to create the instance
via progid or clsid. Note that you need to use the
"Activator.CreateInstance" method rather than "Marshal.GetActiveObject"
==============
object obj =
Activator.CreateInstance(Type.GetTypeFromProgID("Some.Application"));
==============
Marshal.GetActiveObject is used to get an existing running instance of a
COM component(rather than creating a new one):
http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marsh
al.getactiveobject.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Oriane" <oriane@noemail.noemail>
>Subject: Getting an handle on an out-of-process ActiveX
>Date: Thu, 24 Jul 2008 18:21:19 +0200
>
>Hi there,
>
>Inside a .Net project, I want to get an handle on an executable (a.exe)
>ActiveX component instance, that is get it as an object if it is running.
>
>I'll try with this code:
> object o =
>System.Runtime.InteropServices.Marshal.GetActiveObject("StibilServControl.C
StibilServControl");
>
>Unfortunaltely, I'm told that this operation is not available (error +
>$exception {" Operation not available (Exception de HRESULT : 0x800401E3
>(MK_E_UNAVAILABLE))"} System.Exception
>{System.Runtime.InteropServices.COMException}
>
>Any idea ?
>
>The problem is that I use this ActiveX component inside a Web Service and
>that if I simply create an instance of this ActiveX in the Web service
class
>constructor, each call to one of the Web service method calls the
>constructor of the Web service which in turn creates the ActiveX. So at
the
>end, I've got plenty of them when only one would be enough !
>
>Best regards
>
>
>
>