Willy Denoyette said:
Inline ***
*** I'm sorry but you are wrong, the controls are activeX controls that are
wrapped by Winforms Control classes.
VB6 had no COM wrappers, ActiveX controls expose their functionality through
COM interfaces, ActiveX controls are (Single Threaded Apartment) COM objects
that implement some special interfaces.
But if you don't believe me just run ildasm on System.Windows.Forms.dll and
taka a look at the Control class (and other like Container).
Yes, you will find lots of ActiveX and COM stuff in the Control class. This is for two reasons.
One is to allow exposing a .NET control as an ActiveX control. The other is to facilitate wrapping
ActiveX controls in the .NET Control class. That doesn't mean that *every* Windows Forms control
uses ActiveX.
While ildasm is great, I recommend Reflector. Get it at
http://www.aisto.com/roeder/dotnet/.
Whichever tool you use, though, with proper examination it's clear that Windows Forms controls do
not, on the whole, use ActiveX or any part of COM.
VB6 does indeed use COM wrappers. For instance, the ListView and TreeView controls are provided by
MSCOMCTL.OCX. This OCX is an ActiveX wrapper around the controls provided by COMCTL32.DLL. Note
that the "COM" in COMCTL32.DLL stands for "Common", not for "Component Object Model", and that this
DLL is not a COM component.
I programmed using straight C for a long time, Willy. I did not use COM (doing so is a huge
headache at best from C), and yet still managed to use all the standard Windows controls. The
Windows API has been around since long before ActiveX.
*** I know that, but that is not the point, the Windows controls are wrapped
by Windows.Forms, so Windows.Forms controls use COM under the covers, and
you better have STAThread set, or you are in for some weird blocking issues.
Think of this, if you wrap the MSFT Webbrowser control in a .NET class,
don't you think you need a STA thread to run an instance of that class?
That was my point exactly, Willy. If you use a COM control, like the Web Browser control, you must
use the STAThread attribute. If you use standard Windows Forms controls, you do not need to use the
STAThread attribute.