![]() |
|
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Getting an handle on an out-of-process ActiveX
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.GetActiveOb ject("StibilServControl.CStibilServControl"); 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 |
|
|||
|
RE: Getting an handle on an out-of-process ActiveX
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("S ome.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/libr...services.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/subscripti...ult.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/subscripti...t/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.GetActiveO bject("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 > > > > |
|
|||
|
Re: Getting an handle on an out-of-process ActiveX
Hi Steven,
"Steven Cheng [MSFT]" <stcheng@online.microsoft.com> a écrit dans le message de news:i0uFlVg7IHA.4056@TK2MSFTNGHUB02.phx.gbl... > 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? Yes. > 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" Yes if I wish to create it that's what I would write. But I don't want to create it, since it is already running. I want an handle on a running component (since it is an executable, I could have been created before). So I don't really need a later binding approach, but I didn't find any method in Activator to do what I want. Thanks for your support. Oriane |
|
|||
|
Re: Getting an handle on an out-of-process ActiveX
Thanks for your reply Oriane,
No problem. If you need any help in the future, welcome to post here. 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/subscripti...ult.aspx#notif ications. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- >From: "Oriane" <oriane@noemail.noemail> >References: <917F590D-0231-40D8-BA72-467B6AF3B089@microsoft.com> <i0uFlVg7IHA.4056@TK2MSFTNGHUB02.phx.gbl> >In-Reply-To: <i0uFlVg7IHA.4056@TK2MSFTNGHUB02.phx.gbl> >Subject: Re: Getting an handle on an out-of-process ActiveX >Date: Fri, 25 Jul 2008 10:31:13 +0200 > >Hi Steven, > >Happily, I don't need anymore this functionality :-). > >Oriane > |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|