Introduction
<o:p>
This article will helps you to run Windows Application on Web
<o:p>
Note:<o:p>
Try to use the Microsoft windows control, Avoid third party control.<o:p>
Because we are going to use the same control on web<o:p>
<o:p>
Advantages:
<o:p>
Reduces the coding time and resource needed for web<o:p>
Bring the desktop to your web<o:p>
<o:p>
<o:p>
Requirement:
<o:p>
Develop a windows application .For developing weather you can use windows controls
are third party control that’s not a matter.<o:p>
<o:p>
Process:
<o:p>
1.open "New Project " select Visual C# Project and select windows application and
name the project as 'WindowsTOWeb' and click open (Ref :Figure 1)
<o:p>
2. Design the form as shown in the (Ref: figure 2)
<o:p>
3. When you run the form the form will look like this in windows (Ref: Figure 3)
<o:p>
4. Now we want to convert the windows application in to a usercontrol to convert the windows
application in to user control we need to follow the following steps
<o:p>
I> Convert the <o:p>
public class Form1 : System.Windows.Forms.Form<o:p>
TO<o:p>
public class Form1 : System.Windows.Forms.UserControl<o:p>
(Ref: Figure 4)
II> Comment the <o:p>
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<o:p>
Of the windows
<o:p>
Now your windows form application is converted to user control <o:p>
<o:p>
5. Now click the property of the project and change the “Output Type" from Windows
Application to Class Library (Ref: Figure 5)
<o:p>
<o:p>
6. Before compiling the project comments the "thread" (Ref: Figure 6)
Now You have successfully created the user control <o:p>
<o:p>
7. Now add web application in the same solution it self (Ref: Figure 7)<o:p>
<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"><v:f eqn="sum @0 1 0"><v:f eqn="sum 0 0 @1"><v:f eqn="prod @2 1 2"><v:f eqn="prod @3 21600 pixelWidth"><v:f eqn="prod @3 21600 pixelHeight"><v:f eqn="sum @0 0 1"><v:f eqn="prod @6 1 2"><v:f eqn="prod @7 21600 pixelWidth"><v:f eqn="sum @8 21600 0"><v:f eqn="prod @7 21600 pixelHeight"><v:f eqn="sum @10 21600 0"><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"><o:lock aspectratio="t" v:ext="edit">
<v:shapetype stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><o:lock aspectratio="t" v:ext="edit">
<v:shapetype stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><o:lock aspectratio="t" v:ext="edit">
8. Now create a strong name for your user control by using "sn.exe " which is in the location <o:p>
'C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin'.The syntax for creating the
string name is <o:p>
"C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\sn -k "C:\Strongname.snk"<o:p>
now the strong name has been created and it is in the c: in the name of strongname.snk<o:p>
<o:p>
9. After creating the strong name specify the path of the strong name in "Assemblyinfo.cs "
file in the [assembly: AssemblyKeyFile("c:\strongname.snk")] attribute<o:p>
<o:p>
Now the first way of using the user control in the web <o:p>
<o:p>
10. Now by using the "regasm.exe" create and place the CLSID of your dll in the registry
the exe file which is in the location "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ ".<o:p>
<o:p>
11. Then by using the Gacutil.exe register your WindowsToWeb .dll the the registry<o:p>
Then go to the registry and search by the name "WindowsToWeb.dll" and copy the CLSID to the
code behind as Specified in the figure (Ref: Figure 8)
<o:p>
<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"><v:f eqn="sum @0 1 0"><v:f eqn="sum 0 0 @1"><v:f eqn="prod @2 1 2"><v:f eqn="prod @3 21600 pixelWidth"><v:f eqn="prod @3 21600 pixelHeight"><v:f eqn="sum @0 0 1"><v:f eqn="prod @6 1 2"><v:f eqn="prod @7 21600 pixelWidth"><v:f eqn="sum @8 21600 0"><v:f eqn="prod @7 21600 pixelHeight"><v:f eqn="sum @10 21600 0"><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"><o:lock aspectratio="t" v:ext="edit">
12. Now you can see the windows control in the web form (Ref: figure 9)<o:p>
13. Run your web application. Congrats your windows control is now on web
<o:p>
<o:p>
<o:p>
<o:p>
Conclusion:
<o:p>
This is the sample application which I have created when I am in position to run
the windows application which I have created on web page. By using this you
can run only the simple application
<o:p>
I am Prabakar working as Software Engineer .I had been working in Microsoft Platform for the past 3+ years.I have also completed MCP.