Running Windows Forms Controls In Internet Explorer C# Help

Windows Forms controls can be hosted in Internet Explorer as ActiveX controls.

Because there are many different ActiveX control containers; and all these containers do have different requirements on the ActiveX controls, hosting windows controls in any container is not supported by microsoft.

Supported containers are Internet Explorer and MFC containers (MFCcontainers were supported first in Visual studio.NET2003).

With MFC containers, however, you have to manually change the code to host ActiveX controls from an MFC application.

To host a Wmdows Forms control inside Internet Explorer, you have to copy the assembly file to your web server and add some information about the control inside the HTML page. For the support of Windows forms controls syntax of the <object> tag has been extended.

With the attribute classid, you can add the assembly file and the name of the class separated by a II sign:
classid=·<assernbly file>*class name·.
With the assembly file ControlDemo. dll and the class UserControll in the namespace
Wrox. ProCSharp. COMlnterop, the syntax looks like this:
<object id=·myControl·
“”classid= ·ControlDemo. dllllWrox. ProCSharp. COMlnterop. UserControll·
height=·400· width=·400·>
As soon as a user opens the HTML page, the assembly is downloaded to the client system. The assembly is stored in the download assembly cache, and every time the user accesses the page, the version numbers are rechecked.

If the version numbers haven’t changed, the assembly will be used from the local cache.

 A requirement a Windows forms control a web page is that the client must have the .NET runtime installed.

Internet Explorer 5.5 or higlter must be used, and the security setting must allow the downloading of assemblies.

Posted on October 28, 2015 in Interoperability

Share the Story

Back to Top
Share This