Re: Service hangs when accessing ActiveX control




"Lucvdv" <replace_name@xxxxxxxx> wrote in message
news:j3rdi1pp8gvtk7atb1pm2kpai72tu1vijf@xxxxxxxxxx
> On Tue, 13 Sep 2005 16:57:01 +0200, Lucvdv <replace_name@xxxxxxxx> wrote:
>
>> Is there something that has to be taken special care of when using an
>> ActiveX control in a .Net service application?
>
> Add: I've used the same ActiveX control before in services written in VS6,
> and there it works, so it has to be .Net-related.
>
> Something with the activex interop dll's that makes them unsuited for
> services?

First off, ActiveX and Windows Forms should never be used from within
Windows Services, they aren't designed for this kind of scenarios.
The reason your call blocks is that both your form and your control must
live in an STA, now for the AX control this is taken care of by COM itself
which will spin-up an STA thread when you create an instance on an MTA
thread, but your Windows Form will run on an MTA thread (unless you created
the form from an STA thread) and as such can't do the required message
pumping in the COM thread (STA). The result is blocking COM calls.

So what you should do is create the from and the control's instance from an
(the same) STA thread, but again, this is not something I strongly advise
against.

Willy.



.



Relevant Pages

  • How to Decide Between a Browser-Based or Rich Client
    ... many potential clients ask "is it web-enabled" as if that is the ... Windows forms for more complex access. ... Windows applications. ... a while for the 5MB ActiveX control to download :-) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: about IE in Windows CE6 Beta
    ... zhizi. ... It is a pity that I am not a Connect beta participant .If it is a bug, ... my ActiveX control didn't implement ... Is there any difference between Windows CE 5.0 and Windows CE 6.0 Beta ...
    (microsoft.public.windowsce.platbuilder)
  • Re: New Microsoft Updat
    ... I couldn't download the activeX control for Windows ... Windows update site, and choose the link to go to Microsoft update site, I ...
    (microsoft.public.windowsupdate)
  • QuickTime for Windows ActiveX buffer overflow
    ... Apple QuickTime ActiveX v5.0.2 Buffer Overrun ... @stake Vulnerability Reporting Policy: ... QuickTime for Windows ActiveX security advisory ... A buffer overflow exists in the ActiveX control distributed in Apple ...
    (NT-Bugtraq)
  • Re: .NET and ActiveX
    ... I have heard of hosting Windows Forms from ASP.NET (and it is ... A .NET Windows Form is NOT an ActiveX control, ... Web developers often used ActiveX controls to provide rich ... User controls do not download to the client. ...
    (microsoft.public.dotnet.framework)