Silverlight as a mechanism for simplification of application deployment


I think Silverlight is a great technology that can be use to create great applications, or as a migration target from Visual Basic 6, Powerbuilder or Windows Forms apps which can take advantage of a very simplified deployment approach.

And use  Artinsoft/ Mobilize automated solutions (see ) 

Deployment is as simple as just publish your SL application on your intranet and your clients just need to press F5 to have the latest SL version. 

Silverlight provides a good balance between ease of development and platform features(XAML and .NET and Visual Studio). 

Silverlight can run cross-platform. (On Windows and Mac using the official Microsoft implementation and on Linux using Moonlight. 



Support For Silverlight 4



Support For Silverlight 5


Also Silverlight is a good intermediate point if you plan to modernize your application even further to Windows 8 but not just yet. You will find several resources for porting your Silverlight app to Windows 8 like  




NOTE: Moonlight provides support for 32 and 64 bit Linux. It supports Silverlight 2.0, and some features of silverlight 3 and 4, but is not currently an active project.  


Embedding Windows Forms Applications directly in a WebBrowser

"In the past, Web developers often used ActiveX controls to provide rich client-side functionality in their Web applications. Now developers can easily build objects using the Microsoft .NET Framework that are more compact, lightweight, secure and can be hosted within Internet Explorer. By hosting .NET Windows Forms controls in Internet Explorer, developers can accomplish many client-side Web development goals..." 

This is an excellent introduction from Thiru Thangarathinam article in CodeGuru 

 In the rest of this article he provides great details on how to accomplish this task.   


Figure 1: Example of simple Hello Word Windows Forms App embedded in Browser



Figure 2: Example of a more complex Windows Forms App consuming data from a Web Service


" However before using Windows Forms controls in IE, you need to be aware of the benefits and limitations. The main benefits include: 

  •          The ability to deliver dynamic rich user experience through the Web 

  •          Automatic caching of compiled code on the client 

  •          Seamless integration with .NET Code Access Security that allows you to leverage the .NET security model from within the client side 

  •          Improved performance over Java applets 

The constraints include: 

  •           It requires Windows operating system on the client side 

  •           Internet Explorer 6.0-9.0 is the only browser that provides support for this type of hosting 

  •           It requires .NET runtime to be installed on the client machine. 

  •           It also requires Windows 2000 and IIS 5.0 or above on the server side" 

Currently my tests indicate that this technique does not apply for Windows 8. Also issues with .NET code security should be reviewed or additional configuration might be needed in order for restricted operations to be available. (This article from Dino Esposito provides more insight on these security aspects 

Using ClickOnce deployment over the web to simplify Windows Form Application deployment


Artinsoft\Mobilize.Net helps legacy application to be modernized using the Windows Forms technology. Doing this upgrade revitalizes your application code and allows you to take advantage of the new platforms features like ClickOnce deployment. 

What is ClickOnce deployment?   

"ClickOnce is a deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction. Visual Studio provides full support for publishing and updating applications deployed with ClickOnce technology if you have developed your projects with Visual Basic and Visual C#.

ClickOnce deployment overcomes three major issues in deployment: 

  •          Difficulties in updating applications. With Microsoft Windows Installer deployment, whenever an application is updated, the user can install an update, an msp file, and apply it to the installed product; with ClickOnce deployment, you can provide updates automatically. Only those parts of the application that have changed are downloaded, and then the full, updated application is reinstalled from a new side-by-side folder. 

  •          Impact to the user's computer. With Windows Installer deployment, applications often rely on shared components, with the potential for versioning conflicts; with ClickOnce deployment, each application is self-contained and cannot interfere with other applications. 

  •          Security permissions. Windows Installer deployment requires administrative permissions and allows only limited user installation; ClickOnce deployment enables non-administrative users to install and grants only those Code Access Security permissions necessary for the application. 

In the past, these issues sometimes caused developers to decide to create Web applications instead of Windows-based applications, sacrificing a rich user interface for ease of installation. By using applications deployed using ClickOnce, you can have the best of both technologies."

Click Once Deployment Strategies 


There are 3 deployment strategies: 

  • Install from Web or a Network Share 
  • Install from a CD 
  • Start from the Web or Network share 

Quick Overview 


For a quick overview of how to use the ClickOnce deployment take a look at Shahar Gvirtz's post


Problem uploading large files in ASP.NET

12. October 2012 10:35 by Mrojas in ASP.NET, C#, Cloud, General, HTML5, SQL Server, VB6 Migration  //  Tags: , , , ,   //   Comments (0)

If you try to upload large files you might get an exception like

HttpException: Maximum request lenght exceeded.

This problem occurs because the default value for the maxRequestLength parameter in the section 

of the machine.config or Web.config file is 4096 (4M).

So any file with a size bigger will fail.

However I think that the max size that you can write here is 2G 2097151

Some info can be found here:;EN-US;295626


So to change that for 512mb use something like:




        <httpRuntime maxRequestLength="524288" /> 



Crystal Reports in Windows Azure

10. October 2012 08:52 by Mrojas in Crystal Reports, Printing, SQL Server, VB6 Migration, Visual Studio, WinForms  //  Tags:   //   Comments (0)

If you ever wonder, if Crystal Reports can be used on the cloud in Windows Azure, well the answer is you can.

These two links provides some guidance on this matter: (this one is in English) (this one is in Spanish but Bing and Google Translate do a nice work here ;) )

Office Interop and Call was rejected by callee

28. September 2012 13:14 by Mrojas in ActiveX, C#, Memory, VB6 Migration, WinForms  //  Tags: , ,   //   Comments (0)

This issue is mostly cause by timing issues when calling a multi-threaded app.

Some workarounds:


1. Set the application visible property to false. For example if using Word make word visible property false at the start of the method and set it back to true at the end.

This will delay some GUI changes avoiding timing issues.


2. Insert some Thread.Sleep calls (yes this is ugly)


3. Register and IOleMessageFilter. I have copied an implementation from the MSDN


Just copy this class in your code.

At the start of the method call 


            // This registers the IOleMessageFilter to handle any threading 
            // errors.


And at the end


public class MessageFilter : IOleMessageFilter

        // Class containing the IOleMessageFilter
        // thread error-handling functions.

        // Start the filter.
        public static void Register()
            IOleMessageFilter newFilter = new MessageFilter(); 
            IOleMessageFilter oldFilter = null; 
            CoRegisterMessageFilter(newFilter, out oldFilter);

        // Done with the filter, close it.
        public static void Revoke()
            IOleMessageFilter oldFilter = null; 
            CoRegisterMessageFilter(null, out oldFilter);

        // IOleMessageFilter functions.
        // Handle incoming thread requests.
        int IOleMessageFilter.HandleInComingCall(int dwCallType, 
        System.IntPtr hTaskCaller, int dwTickCount, System.IntPtr lpInterfaceInfo) 

            //Return the flag SERVERCALL_ISHANDLED.
            return 0;

        // Thread call was rejected, so try again.
        int IOleMessageFilter.RetryRejectedCall(System.IntPtr 
        hTaskCallee, int dwTickCount, int dwRejectType)

            if (dwRejectType == 2)
            // flag = SERVERCALL_RETRYLATER.
                // Retry the thread call immediately if return >=0 & 
                // <100.
                return 99;
            // Too busy; cancel call.
            return -1;

        int IOleMessageFilter.MessagePending(System.IntPtr hTaskCallee, 
        int dwTickCount, int dwPendingType)
            //Return the flag PENDINGMSG_WAITDEFPROCESS.
            return 2; 

        // Implement the IOleMessageFilter interface.
        private static extern int 
          CoRegisterMessageFilter(IOleMessageFilter newFilter, out 
          IOleMessageFilter oldFilter);

    [ComImport(), Guid("00000016-0000-0000-C000-000000000046"), 
    interface IOleMessageFilter 
        int HandleInComingCall( 
        int dwCallType, 
        IntPtr hTaskCaller, 
        int dwTickCount, 
        IntPtr lpInterfaceInfo);

        int RetryRejectedCall( 
        IntPtr hTaskCallee, 
        int dwTickCount,
        int dwRejectType);

        int MessagePending( 
            IntPtr hTaskCallee, 
            int dwTickCount,
            int dwPendingType);


Problem using ActiveX controls with VS2010

11. May 2012 11:56 by Mrojas in ActiveX, COM Interop, VB6 Migration, Visual Studio, WinForms  //  Tags: , , , , , , , ,   //   Comments (0)


Sometimes during migrations from VB6 to VS2010 we have found issues when you tried to add an ActiveX control with the VS2010 winforms designer. The issue is only present in VS2010 not on previous versions.

You usually will see an error in the added Interop references, and messages like a missing VBA or StdLib library.

The error has been reported several times so please vote on Connect to make sure MS will consider fixing it.


And possible workarounds are running the Aximp manually from the command line and the add the references. You will then need to add the control by hand in your forms. Do not use the designer to add the component, this will try to regenerate the references and reproduice the issue.

Customizing the Look and Feel or your Windows Forms Applications

27. April 2012 17:05 by Mrojas in Controls, VB6 Migration, WinForms  //  Tags: , , , , , ,   //   Comments (0)

Windows forms is still a great technology, but by default is not as flexible as XAML or HTML where you can very easily modify the style of your controls.

But that is not entirely true.

Let's review which options do we have for customizing the look and feel of Windows Forms Applications.


Custom Look And Feel

Well the idea is simple. Centralize all the settings for your components and make sure to invoke that logic just after the initializeComponent() method call on the Windows Form constructor.

I will implement a very simple example:

First the class the implements the "theming logic":

using System.Windows.Forms;
using System.Drawing;
public class ApplicationLookAndFeel
	static void ApplyTheme(TextBox c)
		c.Font = new Font("Arial",12.0f); c.BackColor=Color.Blue; c.ForeColor = Color.White;
	static void ApplyTheme(Label c)
		c.Font = new Font("Arial", 12.0f); c.BackColor = Color.Black; c.ForeColor = Color.White;
	static void ApplyTheme(Form c)
		c.Font = new Font("Arial", 12.0f); c.BackColor = Color.Black; c.ForeColor = Color.White; 
	public static void UseTheme(Form form)
		foreach (var c in form.Controls)
				case "System.Windows.Forms.TextBox":
				case "System.Windows.Forms.Label":

As you see is just very simple code that will just update the settings for all controls, and a simple call in all form constructors and your done:
public partial class Form1 : Form
		public Form1()
A form like:


This approach is simple, but could require a lot of work if you have a lot of components, and switching to another look and feel will require a lot of changes, and it does not allow you to customize all of the form.

Customization of non client are (title bar, borders, requires a little more work). You can take a look at Szymon Kobalczyk work in codeplex. There is a lot of information about a setting custom borders for your forms and even a start of a form styling library. 


Styling Controls

There are some third-parties that provide some level of Theming/Styling. The main difference is the impact they have on existing applications. I categorize them a Little Changes/Big Changes


Little Changes

Visual Styler.NET from

This is an interesting solution, because it allows you to style your Standard Windows Form controls, with very little changes. You just add a control on you main form and that all.  They provide some custom styles and you can built your own. They support styling of ThirdParty Controls but I am not sure how that will work.



For screen shots and details see:


More Changes

Telerik Visual Style Builder




DevExpress WinForms Skins



Infragistics Application Styling



I call this "more changes" because all of them are great styling components but in order to style your application you have to use THEIR components. That is change all your TextBox for RadTextBox in the case of Telerik, Button for RadButton, or change your Label for WinLabel and your Button for WinButton for Infragistics and TextEdit for DevExpress...

So it can be a lot of changes. The end result can be stunning, because all of these companies have very very good components, but it is a lot of changes and can affect your application.


 But as you can see, Windows Forms still has a lot to offer

Migrating .NET applications to Windows CE

22. March 2012 12:05 by Mrojas in VB6 Migration, Windows CE, Windows Mobile  //  Tags: , , , ,   //   Comments (0)

If you have a .NET application and then find that you need to move your application or
part of it to a Handheld or mobile device based in Windows CE don't worry.

The .NET has what is called the .NET Compact Framework which is in general
.NET for mobile devices. However review some info before you start your development
because it is not necessary the same. 


Differences between .NET Framework and Compact Framework

The CF is great but... it is not the .NET Framework. There

are differences take a look at:



For a list of .NET Compact Framework Controls



Some nice Third Party .NET Framework Controls are:


Some useful links:

Need remoting in .NET well you should know that CF does not provide Remoting but there

is company that implements it:


You can also use DCOM


And for BlueTooth

There are several aproaches for developing BlueTooth with .NET.

1)  Bluetooth programming with Windows Sockers. 


2)   Windows Embedded Source Tools for Bluetooth.  


3)    3rd party solution, A nice library is:


Windows Services in CE

See this post: 

and the library is available here:


Sending Messages between EXE files

13. March 2012 10:37 by Mrojas in COM Interop, General, IPC, VB6 Migration  //  Tags: , , , ,   //   Comments (0)

Today someone asked what is a way to send messages between two .NET exes.

mmm Well. Interesting question. There are several approaches.


1. .NET Remoting

.NET remoting is not a new technology but is a core part of the

.NET framework and it's always available:


For an example see this code from:


2. Named Pipes

This is example:


3. WCF

WCF is a great option even if you have legacy VB6 code you can use the SOAP Client to communicate

with the service:

This link

shows an example calling a Coldfusion Service but use it as a base for calling 

a WCF service

You can also integrate WCF with COM+


4. Windows Messages

There is a nice project that wrap it all up for you so you can use this solution: