Search code examples
c#wpfinteropactivex

Using ActiveX control (no associated UI) in C# / WPF app


I have gone through couple of articles on hosting active X control.

http://msdn.microsoft.com/en-us/library/ms742735(v=vs.100).aspx

I see the example uses a Windows Media Player, which is shown to the user.

My requirement is: I have an active X control, and there is no UI associated with it. There is some business logic associated with it and my application is WPF.

My doubt is whether I should still go for the way of using WindowsFormsIntegration for hosting the activeX control or should I simply instantiate the active X control in the helper class and use it through out the life time of my application?


Solution

  • Well hosting an ActiveX component doesn't necessarily mean displaying an ActiveX component. It is perfectly valid to have hidden elements, even if they are fundamentally visual elements, just to have access to their particular properties (and logic). Indeed many customized WPF controls are put together using a variety of visual controls which the user never actually has a clue about. I say host it discreetly in the background and use it was you will.