HRESULT 0x80040202 when adding an event Handler to ShellWindows

0

I'm trying to build up a service that runs in background on a bunch of remote computers that will simply monitor how many times IE is used for statistics purposes. Most of my code is written and it works absolutely fine on my development computer, which has the same specs as the remote computers. I've also made sure the remote computers all have Net Framework 4.5.1.

When starting the service, I get this error message (I log it)

System.Runtime.InteropServices.COMException (0x80040202): Exception HRESULT : 0x80040202
at System.Runtime.InteropServices.ComTypes.IConnectionPoint.Advise(Object pUnkSink, Int32& pdwCookie)
at System.Runtime.InteropServices.ComEventsSink.Advise(Object rcw)
at System.Runtime.InteropServices.ComEventsInfo.AddSink(Guid& iid)
at System.Runtime.InteropServices.ComEventsHelper.Combine(Object rcw, Guid iid, Int32 dispid, Delegate d)
at System.Runtime.InteropServices.ComAwareEventInfo.AddEventHandler(Object target, Delegate handler)
at ServiceLogger.Service1..ctor()

Here is the code that causes this error, it happens when my service is created by program.cs, I have not modified program.cs.

InitializeComponent();
shellWindows = new SHDocVw.ShellWindows(); //Global var
shellWindows.WindowRegistered += shellWindows_WindowRegistered; <-- This is the error

I searched all day on google and no one seems to have this problem and it only happens on the remote computer. Is there something on those computers configuration that causes this issue? Is there a problem with the shdocvw library?

c#
.net
shdocvw
asked on Stack Overflow Feb 24, 2016 by GPierre • edited Feb 24, 2016 by GPierre

1 Answer

0

Turns out it was actually a problem with Internet Explorer itself.

We wanted to prevent users from doing a lot of things on those computers, we fiddled a bit too much with IE and had to install a special version to block a lot of things.

I rebuilt the machine, tested out the service and it works fine.

answered on Stack Overflow Feb 29, 2016 by GPierre

User contributions licensed under CC BY-SA 3.0