Calling ActiveX control from Windows service

G

Guest

Hi all,

I'm developing a .NET application as a Windows service to retrieve data from
a remote server periodically. Because this server uses a proprietary
protocol, I need to use a supplied ActiveX control to communicate with it. So
my question is how can I instantiate ActiveX control from a windows service ?
From my understanding, an ActiveX must be placed on a Form; but in my case
there's no form at all.

Anybody can help me on this ? I don't want to create a hidden form to host
the ActiveX control.

Thanks in advance.

Dotnetjunky
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

Depends on the control. For example, Microsoft Script Control can be
instantiated as just a COM co-class and it does not get upset that it does
not have a parent form. So the first thing to try would be to create an
interop assembly for the control with tlbimp.exe, then to reference this
assembly and try to instantiate the control. Hopefully its communication API
can be used without placing the control on a form.

Also, make sure your Windows service is run under the "Network Service"
account (or under any user account having permissions to access the
network).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top