Channel 9 video on the Visual Basic Upgrade Companion (VSIP Partner video)

12. April 2010 12:16 by Jaguilar in General  //  Tags: , , ,   //   Comments (0)

Today, as part of the Visual Studio 2010 launch, Microsoft published a video of my coworker, Esteban Brenes, doing a brief demo of the latest beta of the Visual Basic Upgrade Companion 4.0. In this video, version 4.0 of the VBUC is used to generate code that works correctly with Visual Studio 2010. This is part of the VSIP Partners CAN DO! series of videos, which can be seen in this link.

Watch the video: VSIP Partners CAN DO! | ArtinSoft Visual Basic Upgrade Companion

VB6 migrations to a new level

12. April 2010 08:17 by Fzoufaly in General  //  Tags: , , , ,   //   Comments (0)

I am proud to announce that today ArtinSoft released version 4.0 Beta of its flagship product the Visual Basic Upgrade Companion.

This new release once more collects our learnings from migrating millions and millions of lines of code from Visual Basic 6 to VB.NET and C#. 

This release revolves around a number of themes:

1) Visual Studio 2010 compatibility: You can now use the VBUC to create projects that are compatible with Visual Studio 2010.

2) Take advantage of new framework features: The code generated by the VBUC now takes advange of some advanced features of the .NET Framework to improve the quality of the code avoiding dependencies to any third party runtime.

3) Compatibility with Windows 7 and 64 bits system: The platform is evolving and the VBUC is evolving along with it.  Now the VBUC is compatible with Win XP, Vista and 7 on both 32 and 64 bits systems.

4) Impoved usability: We are trying to minimize the learning curve to start a VB migration project. There will be even more changes in this theme for the next release. (I am specially excited about this!) 

Please read our official press release, learn the specifics of version 4.0 or give it a try!

You can also watch a video demo on the Microsoft site channel 9: http://channel9.msdn.com/posts/VSIPMarketing/VSIP-Partners-CAN-DO--ArtinSoft-Visual-Basic-Upgrade-Companion/ 

Visual Basic Upgrade Companion 4.0 Beta available for download

12. April 2010 07:10 by Jaguilar in General  //  Tags: , ,   //   Comments (0)

We are very happy to announce the Visual Basic Upgrade Companion 4.0 Beta. You can now download a trial from the Trial Request page. While we complete beta testing, we’ll have both version 3.0 (current release version) and the 4.0 Beta available for download. If you have the chance, we would really appreciate it if you could download the beta, and send us any feedback either through ArtinSoft’s regular support email (support@artinsoft.com) or through my blog Contact Form.

This new version contains a large number of improvements over version 3.0, including:

  • Increased productivity for migration projects, with features such as improved conversion of ByRef/ByVal parameters (specially when working with Windows APIs), TypeName/TypeOf support, improved default property conversion, generate code to explicitly release COM objects when required, and hundreds of smaller enhancements and bug fixes that greatly improve the conversion of VB6.0 code.
  • Improved the user experience by adding localization/internationalization for German and Japanese and completely redesigned the installation and license process. Installing a license is now a straightforward process (no more copying files!!), and it is now possible to install and execute the VBUC on both 32- and 64-bit versions of Windows Vista and Windows 7, as well as 32-bit Windows XP. The installation requirements were also greatly simplified, so you don’t need Visual Studio installed to install the VBUC (though it is still recommended).
    You can now also select the target version of Visual Studio to generate the appropriate Solution file (*.sln). The VBUC can generate Visual Studio Solutions for version 2005, 2008 and 2010.
  • Enhanced Grid migration, by mapping the Microsoft Flexgrid and APEX/ComponentOne TrueDBGrid to a grid that extends the native .NET DataGridView. It will no longer be required to purchase a third-party grid solution when moving from these  grid to .NET if you wish to move to 100% native .NET code without using COM Interop.
  • Improved assessment capabilities, by improving the accuracy of the VBUC Assessment Mode and making additional changes so members without specific mappings are tagged with an EWIs – in the past only members that were explicitly tagged as “Not Mapped” had an EWI.

You can read more details on the new features of version 4.0 in this page: What’s new in VBUC 4.0? Make sure you try out these new features by downloading a trial.

VBUC40UIVisual Basic Upgrade Companion 4.0 User Interface. You can now select the target version of Visual Studio,
and also note the license icon at the bottom of the window.

AutoCAD VBA Migration to VB.NET or C#

AutoCAD 2010 will not be supporting VBA.

Quoting

“If you utilize VBA macros in your work environment, they will no longer work unless the VBA module is installed on your system. “
“When you run a command that requires VBA, a message dialog box will be displayed stating that VBA is no longer installed with AutoCAD and directing you to a website where you can download the VBA module. “

And also you can see that Autodesk states: “Autodesk is evaluating how long VBA will be supported in Autodesk products in the future. Though supported in the AutoCAD 2010-based products, it may or may not be supported in future releases. Therefore, it is strongly recommended that VB developers develop all new code using VB .NET.

VBA does not support 64bit systems in a native way.

But If you want some advice from the VB migration experts or help on your migration project from VBA to VB.NET or C# you can us contact Artinsoft Migration Services.

We build the VB Upgrade Wizard that shipped with Visual Studio and have been doing VB migrations for years.

VB6.0 Legacy Migration article at Visual Studio Magazine

3. March 2010 05:54 by Jaguilar in General  //  Tags: , , , ,   //   Comments (0)

In it March issue, Visual Studio Magazine published an in-depth article about legacy migrations called “Unlocking Legacy Code”. This article talks about the challenges faced by companies migrating from Visual Basic 6.0 to .NET, the drivers behind these migrations and the pros and cons of using an automated migration solution.

The article uses BEMAS Software as a case study for successful migration products. I am incredibly happy they are doing as well as they are with the conversion – they are using our tools, and I visited BEMAS about a year and a half ago to train them on the VBUC and help them plan the migration project. I remember they had a lot of conditional statements (by “a lot”, we are talking thousands of different combinations), as mentioned in the article:

"We also ran into some issues with the conversion tool because early on in the VB code we did a lot of #ifs, which means that the code acts differently depending on how you compile it," Pownall adds. BEMAS worked with ArtinSoft so that VBUC would recognize those instances and convert the code correctly.

It was quite a challenge to get it to convert, since the default behavior of the VBUC is to convert the code inside the conditional statement that evaluates to “TRUE”. Commenting out the conditionals wasn’t going to work either, since that would cause multiple variable declarations and other semantic errors that caused issues during the migration of this particular code. In the end we worked together with BEMAS, and with heavy involvement of the VBUC development team, we managed to modify the tool enough to get the code converted correctly.

Another very interesting item mentioned by Steve Pownall in the article, that I want to talk about some more, is the fact that even though the code came through very cleanly, it didn’t have the .NET architecture they were aiming for so they had to “The dev team had to massage or opted to rewrite the rest of the codebase manually in C# and .NET 3.5 using VS2008.”. This is a very important point, since the overall architecture of the code will remain as it was in VB6.0. The migration, however, gets you quickly to a stable .NET codebase that you can then rework to make it take advantage of the latest features of the .NET Framework. In our experience, this path (migrate, then enhance) is the one with the lowest risk, and it allows you to reduce the time to market for your applications by a wide margin. This is important to keep in mind, since we, as developers, always want to improve the code base – it is part of our professional formation, and I would say, part of our nature – but we sometimes fail to grasp the additional risk this implies. The migration is very controlled process, that gets you predictable results in a short time. Enhancing the application after the migration may seem like duplicating work (and indeed, there are enhancements that can be done during the migration process) but it guarantees that you will get a .NET in the allocated timeframe and budget, not to mention the cost advantage.

Read the complete article, Unlocking Legacy Code at Visual Studio Magazine.

Error Handling Customizations

16. February 2010 10:52 by Jaguilar in General  //  Tags: , , ,   //   Comments (0)

One very common requirement for migration projects is to adapt certain error handling patterns used in a customer’s Visual Basic 6.0 code to the structured error handling provided by .NET, cleaning up the code, improving its maintainability, and, whenever possible, complying with .NET best practices.

The VBUC already converts several commonly used error handling patterns, such as the ones described in this old post. There are, however, situations where the VBUC is not able to recognize a pattern. these usually involve Goto statements, On Error Resume Next, Resume Next or some other construct usually associated with “spaghetti code”. When one of these patterns is encountered, the VBUC does a very basic transformation and generates an EWI so it can be cleaned up through manual intervention later on, such as in the following example:

Visual Basic 6.0 Code

.NET Code

Private Function <NAME>(<PARAMS>) As <TYPE> 
  Const MethodName As String = "<NAME>" 
       On Error GoTo ErrorLabel 
       <STATEMENTS 1> 
       On Error GoTo <LABEL> 
       <STATEMENTS 2> 
  CleanUp: 
       <STATEMENTS 3> 
       Exit Function 
                
  <LABEL>: 
       <STATEMENTS 4>       
       LogError(MethodName) 
       Err.Raise 16, , MethodName 
                
   ErrorLabel: 
       <STATEMENTS 5> 
       LogError(MethodName) 
       Err.Raise Err.Number, , MethodName 

End Function 
 
private <TYPE> <NAME>() 
{ 

const string MethodName = "<NAME>"; 
//UPGRADE_TODO: (1065) 
Error handling statement
(On Error Goto) could not be converted. More Information:
http://www.vbtonet.com/ewis/ewi1065.aspx
NotUpgradedHelper.NotifyNotUpgradedElement( "On Error Goto Label (ErrorLabel)"); <STATEMENTS 1> try { <STATEMENTS 2> <STATEMENTS 3> return result; } catch (Exception ex) { <STATEMENTS 4> LogError(MethodName); throw new System.Exception( ((int) 16).ToString() + ", " + String.Empty + ", " + MethodName); ErrorLabel: <STATEMENTS 5> //UPGRADE_WARNING: (2081)
Err.Number has a new behavior.
More Information:
http://www.vbtonet.com/ewis/ewi2081.aspx
LogError(MethodName); throw new System.Exception( Information.Err().Number.ToString() + ", " + String.Empty + ", " + MethodName); return result; } }

Most of the time it is possible to generate a solution that will correctly convert the error handling pattern, maintaining functional equivalence and meeting any additional coding guidelines from our customers. For the previous example, The VBUC can be customized so the generated code looks as follows:

try 
{ 
       try 
       { 
              <STATEMENTS 1> 
       } 
       catch (Exception ex){ 
              <STATEMENTS 5> 
              throw; 
       } 
       try 
       { 
              <STATEMENTS 2> 
       } 
       catch (Exception <LABEL>Ex) 
       { 
              <STATEMENTS 4> 
              <LABEL>Ex.Data.Add("ERROR",16); 
              throw; 
       } 
} 
finally 
{ 
       <STATEMENTS 3> 
}

This example makes some assumptions on the nature of the code and on the intention of the original VB6.0 developer, in particular:

  • Errors raised by  <STATEMENTS 1> should be handled by <STATEMENTS 5>
  • Errors raised by  <STATEMENTS 2> should be handled by <STATEMENTS 4>
  • <STATEMENTS 3> is cleanup code that should always be executed
  • The Exception needs to be thrown again without loosing any information

This is just an example, but the intention is to show what type of customizations can be done. The VBUC transformation engine is very powerful, and, as long as a pattern can be identified, can help you automate the solution to most VB6.0 problems.

DataGridView does not show Horizontal scrollbar

16. February 2010 10:25 by Mrojas in General  //  Tags: , , , ,   //   Comments (0)

During a migration from a FlexGrid to a DataGridView, we encountered a situation where the HorizontalScrollBar did not show.

I found many suggestions like setting a MinimumColWidth value for all columns, etc.

But it wasn’t until my friend Jesus added a line like:

 

mygrid.DockStyle = DockStyle.Fill

that the HorizontalScrollBar appear.

It might just be that the grid was too big for form but just for the record this is a possible solution.

Escape characters for SQLLoader

9. February 2010 18:49 by Mrojas in General  //  Tags: , , , ,   //   Comments (0)

 

The LINC/EAE migration tool can automatically generate reports that can be used to extract your data from DMSII to your target database, for example Oracle.
In this scenarios the Oracle SQL Loader tool is used. However you might problems loading the data because the string values can contain the same characters you are using to enclose them.

Let’s see an example, taken from an oracle forum:

C:\ora>type buyer.ctl
LOAD DATA
INFILE 'buyer.data'
truncate into table BUYER
FIELDS TERMINATED BY ',' optionally enclosed by '"' TRAILING NULLCOLS
(
buyer_code,
BUYER_NAME
)
 

And suppose you have data like:

1,"XYZ IND"
2,"ABC"
3,"XYZ ABC"
4,"Your "offspring""
5,"ATUL"

How can you “escape” the enclosing characters. Well I found the answer in another forum:

If two delimiter characters are encountered next to each other, a single occurrence of the delimiter character is used in the data value. For example, 'DON''T' is stored as DON'T. However, if the field consists of just two delimiter characters, its value is null.

So just use something like:

 

1,"XYZ IND"
2,"ABC"
3,"XYZ ABC"
4,"Your ""offspring"""
5,"ATUL"

Revisiting Windows 7 XP Mode

4. February 2010 11:28 by Jaguilar in General  //  Tags: , ,   //   Comments (0)

Back when it was first announced I made a couple of posts about Windows 7 XP Mode (available here and here). Now that I’ve been using almost every day for the past few months, I wanted to revisit the topic and write about my hands-on impressions. In this post I’ll show how applications that run under XP Mode integrate with the regular Windows 7 environment.

The integration features of XP Mode work really well, for the most part. Applications installed in the Virtual Machine appear right there on the Start Menu:

 XPM01 
The Start menu gains a “Windows XP Mode Applications” folder under “Windows Virtual PC”,
which holds all apps installed in the XP  Mode virtual machine (click picture to enlarge)

And even show up when searching, which is extremely convenient.

 XPM02
The Quick Search functionality of the Start menu covers
XP Mode Applications. (click picture to enlarge)

When you launch applications, Windows starts up the XP Mode virtual machine behind the scenes, showing a progress toolbar instead of XP’s boot up sequence.

XPM03
Windows XP Mode virtual machine startup. Notice it is running under
Windows Virtual PC. (click picture to enlarge)

Once the application starts up, you’ll notice it is running on XP Mode since the UI uses XP’s windows, instead of Aero:

XPM04
Visual Basic 6.0 on XP mode, complete with default Windows XP “Luna” theme. (click picture to enlarge)

The following screenshot shows this more clearly, by contrasting the Visual Basic 6.0 IDE running under XP Mode and Visual Studio 2008 running directly on the Windows 7 desktop.:

XPM05
Visual Basic 6.0 on XP mode (Luna theme) vs. Visual Studio 2008
on Windows 7 (Aero Glass theme). (click picture to enlarge)

Another VERY NICE feature is that the "My Documents” folder is transparently mapped to Windows 7’s “Documents” library:

XPM06 
Visual Basic 6.0 on XP mode Open Project dialog showing the My Documents folder.
Notice the same contents on the Documents library in Windows 7. (click picture to enlarge)

These integration features of XP Mode make life much easier for legacy applications, but it is far from perfect. In the next post I’ll mention the annoyances I’ve run into while working with XP Mode.

Get Table Owner in Oracle

3. February 2010 12:40 by Mrojas in General  //  Tags: , , , , ,   //   Comments (0)

 

When we migrate from LINC/EAE to Oracle, the migration tool generates an schema an tables form the original ISPECS.
I came across with the problem that I had been playing around with a test database and I didn’t know who was the owner of the table.

Well just as a reminder this is what is needed:

select owner, table_name, tablespace_name   from dba_tables   where table_name='YOUR_TABLE';
This will return something as:
 

OWNER                    TABLE_NAME  TABLESPACE_NAME
------------------------------ ------------------------ ------------------------------
THE_OWNER               MY_TABLE       USERS

Get Java Version for Oracle Stored Procedures

1. February 2010 06:17 by Mrojas in General  //  Tags: , , ,   //   Comments (0)

If you have to write stored procedures for oracle is important
to notice which Java version is supported by your Oracle Database,

A common technique is create a JAVA stored procedure for that:

1. Create a function with an ORACLE SQL statement like:

CREATE OR REPLACE FUNCTION getJavaProperty(myprop IN VARCHAR2)
RETURN VARCHAR2 IS LANGUAGE JAVA
name ‘java.lang.System.getProperty(java.lang.String) return java.lang.String’;

 

2. Once you created the function you can use it to get the version:

SELECT getJavaProperty(‘java.version’) from dual;

You can see in the attached version that for my Oracle Database 10.1.0.4.2 the Java version is 1.4.2_04 :)

image

File Previewers for Outlook

26. January 2010 09:56 by Mrojas in General  //  Tags:   //   Comments (0)

As I developer I usually receive emails with .zip attachments and .xml attachments. When I’m looking for an old email I hate that I have to open the attachment just to see if it has the files I’m looking.

image

Why isn’t there a built-in preview functionality for .xml and .ZIP files?

So I thought, I’m a developer I can build one. And I found an excellent article about the File Previewers in Outlook 2007 and Windows 7 by Stephen Toub.

I just updated the project files to VS 2008 and removed the dependencies to VJ# replacing them by the SharpZipLib library.

image 

And it works well and does not require you to install anything else!

 

Below you can see an example of Zip File preview

image

And and example of XML File Preview

image

I think is an excellent article and I can know write my own previewers every time I need them.

 

Download the code from CODE HERE

Download the installer from INSTALLER HERE

The VB.NET versus C# decision process

18. December 2009 08:27 by enassar in General  //  Tags:   //   Comments (0)

 A while ago I wrote about the decision that many people face when starting to consider a migration from Visual Basic 6.0 to the .NET platform: choosing the target language, mainly between VB.NET and C#. Today I found a great post by John Fuex on that subject, not inciting the war between both trenches but instead describing the process he and his company went through to solve the C# versus .NET dilemma. He basically used the following criteria to qualify each language: Functionality, Learning Curve, Existing Code, Developer Preferences, “Street Cred” (for both the developers and products), and Recruiting. But in the end it reinforces the notion that there’s not a standard solution, so the selection should always be made case by case.

You can read the whole post here.

ActiveX Server Migration to .NET

14. December 2009 08:01 by Mrojas in General  //  Tags: , , , , , , , , , ,   //   Comments (0)

 In VB6 ActiveX-EXEs or ActiveX OLE Server where used for several reasons. Sometimes it was performance (because it allowed you to run your code in another process) and sometimes as way to share resources between several applications, like connection information, database connections, mainframe info, etc.

During migration some of this ActiveX-Exes can be migrated as simple Assembly DLLs, but other require more attention. Specially if they have global variables that hold state shared by several programs.

In that is your case what are your options then?

1. Convert those ActiveX-Exes to Windows Services.

This option is simple. You modify your migrated assembly to work as a Windows Service. The easier way to do that is:

a) Start Microsoft Visual Studio 2005\2008

b) Go to File\New…\Project… and Select Windows Service

That will generated code like:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
namespace WindowsService1
{
   public partial class Service1 : ServiceBase
   {
      public Service1()    InitializeComponent();    }
     
protected override void OnStart(string[] args)    {   }
     
protected override void OnStop()    {   }
   }
}

c) Add a reference to the Remoting Assemblies: System.Runtime.Remoting;

d) Modify the previous code:

Add two using statements like:

using System.Runtime.Remoting.Channels.Http;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting;

Add a simple event log for tracing:

 

private static EventLog evt = new EventLog(“Application”);
private static string SVC_NAME = “ActiveX Server Example Svc”;

 And modify the OnStart and OnStop methods to look like:

  protected override void OnStart(string[] args)
{
    HttpChannel chnl = new HttpChannel(1234);
   
ChannelServices.RegisterChannel(chnl,true );
   
RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyClass), “MyClass.soap”, WellKnownObjectMode.Singleton);
   evt.WriteEntry(SVC_NAME + ” Started”);

}

protected override void OnStop() { evt.WriteEntry(SVC_NAME +” Stoppped”); }

Also make sure that MyClass extends MarshalByRefClass

2. Convert those ActiveX-Exes using the Artinsoft ActiveX migration helpers.

 Sometimes, you need your migrated application to replicate some of the original ActiveX EXE \OLE DLL VB6 characteristics. For example you need your ActiveX-EXE to start just when the first instance is created and to resemble the VB6 logic for Process creation\destruction.

For that purpose Artinsoft has created some helpers that our migration tool is able to automatically use in the generated code if it detects that this functionality is needed.

The code will then be changed from:

Dim myInstance As New MyProject.MyClass

To the following Helper method:

myInstance = MyProjectFactory.Create< MyProject.MyClass>(myInstance);

 And destroy calls can be changed to the following Helper method:

 myInstance= MyProjectFactory.Dispose<MyProject.MyClass >( myInstance); 

The migration tool will modify your ActiveX-EXEs or OLE Servers to be Windows EXE and the helper will then locate the assembly that contains the desired Class, create an instance and initilize a Remoting channel to the desired classes. Settings as SingleUse and MultiUse are also taken care by the helpers.

3. Other possible alternatives are using WFC and COM+ that I will comment in another post.

 

 

 

 

Return argument has an invalid type

10. December 2009 07:39 by Mrojas in General  //  Tags: , , , , ,   //   Comments (0)

When you develop applications with remoting, or in some COM + Remoting scenarios, you could start founding very interesting exceptions.

We had a very unconfortable one. We had an ActiveX that is used in an intranet Web Page, that uses remoting to instanciate some classes in the local network.

When we runned outside of the IE, everything seem to work, but running in IE it produced an exception like:

Error : Return argument has an invalid type.
Type  : System.InvalidCastException
Source: mscorlib
Source: at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)
at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

Why??? Well what happens is simple, it is having an assembly resolution problem, it is not being able to resolve the type.

We solve the problem adding something like:

1. Find a place in your code to add an event like this (it could be in the Main of your program for example):

AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
 
2. Add a handler like this: 

static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
  
System.Reflection.Assembly assembly = null; 
   try
   {
        
assembly = System.Reflection.Assembly.Load(new System.Reflection.AssemblyName(args.Name));
   }
   catch (Exception ex)
  
      
System.Diagnostics.Trace.WriteLine(
            string.Format(“Problem with resolution of {0} : {1} {2}”, args.Name, ex.Message, ex.StackTrace));
   }
   return assembly;
}

Well, this worked for us, and I hope that helps you out.

 

Visual Basic 6 and Windows 7: Alternatives for Application Compatibility Webcast Recording Available

19. October 2009 07:29 by Jaguilar in General  //  Tags: , , ,   //   Comments (0)

A quick post to let you all know that the recording of last week’s webcast I did on compatibility options for Windows 7 is now online. In this webcast I briefly covered different compatibility options available for Windows 7, mentioning things like virtualization (such as XP Mode) and Remediation, and the focusing on the benefits of using automated migration tools to get the application off VB6.0 and into .NET so it can take advantage of the new APIs available in Windows 7 (Taskbar API, touch API, etc).

See the recording here

5 myth-busting reasons for choosing an automatic migration against a manual rewrite

13. October 2009 10:22 by enassar in General  //  Tags: ,   //   Comments (0)

There are still many myths out there surrounding software migrations. Through all the years we have found not only that many people still ignore that there are automatic migration tools available, but some believe that automation is just more trouble than it’s worth, and that, besides, it is just plain better to start from scratch. To concur with this idea is, for starters, to simply devalue all of the effort and thought that was put into developing the application, therefore willing to risk years of business knowledge embedded in these systems.

In any case, the truth is that a rewrite from scratch implies a much more difficult task, but due to these misconceptions, valuable resources are wasted in projects that sometimes just never get to see a successful ending. There’s no doubt that any software renewal project isn’t a simple, overnight task, but a well-planned automated migration can make the process comparatively painless. So once you learn about the availability of advanced migration technologies that allow generating code of a superior quality, with a much lower project cost, time and risk, you will definitely agree that using automated migration tools as part of an overall software renewal initiative is the most viable way to leverage the current investment in legacy applications and move them to the latest platforms.

With that in mind I just wrote a white paper highlighting the main myth-debunking reasons why an automatic migration is a far better software modernization approach than a manual rewrite, based not only on ArtinSoft’s own experience in migration projects but on all the customer and industry analyst feedback and evidence gathered over the years.

So click on the link and read or download for free the “5 myth-busting reasons for choosing an automatic migration vs. a manual rewrite” white paper.

Code compiles but System.IO.FileNotFound Exception is thrown

2. October 2009 10:04 by Mrojas in General  //  Tags: , , , , , , ,   //   Comments (0)

We have seen a situation that can be a little annoying.
I usually find that situation in ASP.NET projects, but it can also happen in Winforms.

The issue is like this:

  • You have a VStudio Solution
  • You have added all the needed references
  • All your code compiles

 

BUT

When you run the application it terminates at a certain point with a
FileNotFound exception indicating that the assembly blablabla  or one of its
dependencies could not be loaded.

 

Whats hapenning!!!

Do this:

1) Look at the bin\debug or bin\release and make sure that the assembly is in those directories.

2) If the assembly is not there, then go to the project references in the solution explorer, right click and select properties and set the Copy Local Setting

 

image

Mapping VBRUN.RasterOpConstants

1. October 2009 05:44 by Mrojas in General  //  Tags: , , , , ,   //   Comments (0)

 

vb Constant Decimal Value Hex Value .NET
vbDstInvert 5570569 H550009
System.Drawing.CopyPixelOperation.DestinationInvert
vbMergeCopy 12583114 HC000CA
System.Drawing.CopyPixelOperation.MergeCopy
vbMergePaint 12255782 HBB0226
System.Drawing.CopyPixelOperation.MergePaint
vbNotSrcCopy 3342344 H330008
System.Drawing.CopyPixelOperation.NotSourceCopy
vbNotSrcErase 1114278 H1100A6
System.Drawing.CopyPixelOperation.NotSourceErase
vbPatCopy 15728673 HF00021
System.Drawing.CopyPixelOperation.PatCopy
vbPatInvert 5898313 H5A0049
System.Drawing.CopyPixelOperation.PatInvert
vbPatPaint 16452105 HFB0A09
System.Drawing.CopyPixelOperation.PatPaint
vbSrcAnd 8913094 H8800C6
System.Drawing.CopyPixelOperation.SourceAnd
vbSrcCopy 13369376 HCC0020
System.Drawing.CopyPixelOperation.SourceCopy
vbSrcErase 4457256 H440328
System.Drawing.CopyPixelOperation.SourceErase
vbSrcInvert 6684742 H660046
System.Drawing.CopyPixelOperation.SourceInvert
vbSrcPaint 15597702 HEE0086
System.Drawing.CopyPixelOperation.SourcePaint

IE Explorer and Favorites folder or Special Folders in general

29. September 2009 04:05 by Mrojas in General  //  Tags: , , , , , ,   //   Comments (0)

I found this email in my inbox today:

Hi Mauricio,I came across a reference to your blog at :http://stackoverflow.com/questions/1286746/c-open-link-in-new-tab-webbrowser-control

I have been studying your writings on extending the WebBrowser control, and verified that the extended web code you wrote for C# compiles and works fine in VS 2010 beta, against FrameWork 4.0.

Many thanks for the valuble code and writing !

I am "stuck" on how to read the contents of an IE browser page when the page is displaying a local file, like the contents of the Favorites folder.

All my attempts to get at the Document or DomDocument by casting it to the usual mshtml.dll interfaces fail.

I am NOT asking you to answer my question, or respond, but if you ever get interested in blogging about this aspect of use of IE, I think many people would be interested.

I have done a lot of research on the net, and posted my own question on StackOverFlow : so far not one real pointer, and, possibly, this is not "doable" (?) : maybe what you are seeing when IE shows a file contents is a kind of "virtual explorer" view that is not parseable.

best, Bill xxxxxx”

And I decided to take at look at it to see if I could be of any help and I found out that it is easy and doable.

So I find an useful link by Andreas M. if you want to look at it.

In general My Favorites, Desktop, etc are special folder. So they need a trick to be able to access them.

 

image

Take the code from my ExtendedWebBrowser sample published in http://blogs.artinsoft.net/mrojas/archive/2009/05/01/opening-popup-in-a-newwindow.aspx

and http://blogs.artinsoft.net/mrojas/archive/2009/08/07/newwindow3.aspx and

1. Add a reference to %windir%\system32\shell32.dll

2. Add a new property to the ExtendedWebBrowser like:

    /// <summary>
    /// Returns the shell folderview object displayed in the webbrowser control.
    /// </summary>
    public Shell32.IShellFolderViewDual2 FolderView
    {
        get
        {
            return ((SHDocVw.WebBrowser)base.ActiveXInstance).Document
                     as Shell32.IShellFolderViewDual2;
        }
    }

And now you can access the special folder from your code. As Bill mentioned, that “page” or “special page” is not real HTML and not parseable but you can examine its contents for example you can do something like:

        /// <summary>
        /// Button 1_ click
        /// </summary>
        private void button1_Click(object sender, EventArgs e)
        {
            Shell32.IShellFolderViewDual2 specialFolder = this.extendedWebBrowser1.FolderView;
            string folderName = specialFolder.Folder.Title;
            string parentFolder = specialFolder.Folder.ParentFolder.Title;
            foreach (Shell32.ShellFolderItem f in specialFolder.Folder.Items())
            {
                if (f.IsFolder)
                    System.Diagnostics.Debug.WriteLine("Folder:" + f.Name);
                else
                    System.Diagnostics.Debug.WriteLine("File:" + f.Name);
            } // foreach
        } // button1_Click(sender, e)

Categories