I have a pretty complex class which extends System.Windows.Forms.UserControl
. It's written in C++/CLI with the /clr
switch, because it uses native C++ dlls. The class's main responsibility is acting as a wrapper for an unmanaged Direct3D9 dll which renders images over textures, zooms, pans, etc.
Is there any way to reuse this class in a .NET web application? In other words, I want to get my user control to run inside a browser. The main uncertainties here are the access to native dlls, and the use of Direct3D. I'm setting up a small test to see if I can get this to work, but I'd like some input from someone else.
Update: I followed this guide. On the first try, I got an error saying that it could not load the control's dll or one of its dependencies. So, just for testing, I copied all the unmanaged dlls it uses to system32. Now I can load the page without errors, but I still cannot see the control. I placed the reference to it in the About
page from the default C# Web App project, like so:
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
About
</h2>
<p>
Put content here.
</p>
<object id="MyWinControl1" height="200" width="200" classid="http:MNeoConsole.dll#MNeoConsole.MNeoConsoleControl">
<param name="Title" value="Locura loca" />
<param name="Visible" value="true" />
</object>
</asp:Content>
I'll try the ActiveX approach now, but even if that works, I guess that would force my clients to use Internet Explorer, or install some plugin, wouldn't it? That would be really bothersome.
Edit: By now, I'm willing to try other approaches. For example, since my C++/CLI class is just a wrapper, I'm willing to write another wrapper in some other laguage. If I go that way, that language should be as friendly with web applications as possible.