Re: mfc activex control in c# windows service
From: Dmitriy Lapshin [C# / .NET MVP] (x-code_at_no-spam-please.hotpop.com)
Date: 02/16/05
- Next message: Wilfried Mestdagh: "Re: SQL connection to Access database"
- Previous message: Dmitriy Lapshin [C# / .NET MVP]: "Re: Ignoring Mouse Events During WaitCursor"
- In reply to: andy.g.ward_at_gmail.com: "mfc activex control in c# windows service"
- Next in thread: andy.g.ward_at_gmail.com: "Re: mfc activex control in c# windows service"
- Reply: andy.g.ward_at_gmail.com: "Re: mfc activex control in c# windows service"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 16 Feb 2005 15:35:49 +0200
Hi Andy,
1. Why do you use the AxHost class in a windows service? I am pretty sure
creating an interop assembly and instantiating the COM component instance
through the constructor exposed by its interop class is much more correct
solution.
2. The location of the OCX on disk is irrelevant. Given the OCX is properly
registered, it's location is stored in the registry so the system is able to
locate and load the .OCX file. If the OCX is not registered, no 'special'
location would allow the system to instantiate it with CoCreateInstance.
3. Can your OCX operate in non-visual mode? Windows services don't have any
GUI, they are even not allowed to interact with the desktop by default.
-- Sincerely, Dmitriy Lapshin [C# / .NET MVP] Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx <andy.g.ward@gmail.com> wrote in message news:1108506175.171028.106920@z14g2000cwz.googlegroups.com... >I keep getting this when trying to create an MFC activex control in a > c# windows service - anyone got any ideas what the missing module could > be??? > > Exception thrown : System.IO.FileNotFoundException: The specified > module could not be found. > at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& > clsid, Object punkOuter, Int32 context, Guid& iid) > at System.Windows.Forms.AxHost.CreateWithoutLicense() > at System.Windows.Forms.AxHost.CreateWithLicense(String license) > at System.Windows.Forms.AxHost.CreateInstance() > at System.Windows.Forms.AxHost.GetOcxCreate() > at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state) > at System.Windows.Forms.AxHost.CreateHandle() > at System.Windows.Forms.Control.CreateControl(Boolean > fIgnoreVisible) > at System.Windows.Forms.Control.CreateControl() > at MyService.MyService.Process() in s:\myservice\service1.cs:line 93 > > For more information, see Help and Support Center at > http://go.microsoft.com/fwlink/events.asp. > > > I have tried MANY different ways to use an MFC ActiveX control in my c# > windows service but I consistently come up against the above error > message. There can't be any missing modules since the ocx I am trying > to create is in the same directory as the #c service exe. > > Many thanks for any help, > Andy >
- Next message: Wilfried Mestdagh: "Re: SQL connection to Access database"
- Previous message: Dmitriy Lapshin [C# / .NET MVP]: "Re: Ignoring Mouse Events During WaitCursor"
- In reply to: andy.g.ward_at_gmail.com: "mfc activex control in c# windows service"
- Next in thread: andy.g.ward_at_gmail.com: "Re: mfc activex control in c# windows service"
- Reply: andy.g.ward_at_gmail.com: "Re: mfc activex control in c# windows service"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|