tags:

views:

456

answers:

1

I have a C# .NET 2.0 application that loads legacy VB6 modules (which we have not converted yet) which are ActiveX controls (.ocx files) the application loads these from the main C# .NET form via interops.

Since service pack 2 for .NET 2.0 our users have been getting random errors where the application will throw a "Windowless ActiveX controls are not supported" error. The ActiveX controls are not windowless.

This seems to be an issue others have come up against but I have not found a soultion that has worked.

One of the often offered solutions is turn off DEP for the process and I have tried this.

Anyone ever come up against this problem before?

A: 

Your problem is related to the use of the controls in MSWLESS.OCX. You may have to replace all the controls used from this OCX with their regular VB equivalents. There are not too many functional differences between the two sets of controls so you may be lucky.

I got rid of my Windowless VB controls a few years ago when problems started to appear. If I remember correctly, I was able to mostly do a search and replace in the .frm files to replace the controls.


Update:

Wow, that really sucks. Is it possible that your Active X controls are actually Windowless? There is a property on a UserControl called WindowLess that makes your control Windowless. Is it set to True for any of your user controls?

Darrel Miller
We are not using MSWLESS.OCX anywhere. I did a double check to make sure.
Daniel
Check the whole VB source tree to make sure and nothing has Windowless set to True.It is an intermittent issue i.e. the users do not get it all the time. Seem to be cyclic use of the app i.e. opening and closing the same VB windows all the time.
Daniel
@Darrel Miller: FYI, by specification if the hosting container does not support windowless controls it uses "windowful" instantiation. So in VB6 you can mark a control as "supporting windowless" instantiation but it will always support "windowful" instantiation. That's why in an Access form an ActiveX control will always get a separate hWnd as Access containers do not know how to host "windowlessly". So a "windowless" VB6 usercontrol in Access form "turns" to "windowful" one (`UserControl.hWnd <> 0`).
wqw
@wqw Ok, that makes sense. You learn something new every day!
Darrel Miller