<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.artinsoft.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Mauricio Rojas Blog</title><subtitle type="html" /><id>http://blogs.artinsoft.net/mrojas/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.artinsoft.net/mrojas/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.20917.1142">Community Server</generator><updated>2009-09-27T00:06:54Z</updated><entry><title>AutoCAD VBA Migration to VB.NET or C#</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2010/03/05/autocad-vba-migration-to-vb-net-or-c.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2010/03/05/autocad-vba-migration-to-vb-net-or-c.aspx</id><published>2010-03-05T19:56:00Z</published><updated>2010-03-05T19:56:00Z</updated><content type="html">&lt;p&gt;AutoCAD 2010 &lt;a href="http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&amp;amp;id=12900036&amp;amp;linkID=9240617"&gt;will not be supporting VBA&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Quoting &lt;/p&gt;  &lt;p&gt;&lt;em&gt;“If you utilize VBA macros in your work environment, they will no longer work unless the VBA module is installed on your system. “     &lt;br /&gt;&lt;/em&gt;&lt;em&gt;“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. “&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;And also you can see that Autodesk states: &lt;strong&gt;“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.&lt;/strong&gt;”&lt;/p&gt;  &lt;p&gt;VBA does not support 64bit systems in a native way.&lt;/p&gt;  &lt;p&gt;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 &lt;a href="http://www.artinsoft.com/ms_contactneeds.aspx?idn=16"&gt;Artinsoft Migration Services&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;We build the VB Upgrade Wizard that shipped with Visual Studio and have been doing VB migrations for years.&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2091" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="VIsual Basic .NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VIsual+Basic+.NET/default.aspx" /><category term="VB6 Migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VB6+Migration/default.aspx" /><category term="C#" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/C_2300_/default.aspx" /><category term="64-bit" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/64-bit/default.aspx" /><category term="migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/migration/default.aspx" /><category term="VB.NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VB.NET/default.aspx" /><category term="upgrade" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/upgrade/default.aspx" /><category term=".NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/.NET/default.aspx" /><category term="Visual Basic to .NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Visual+Basic+to+.NET/default.aspx" /><category term="AutoCAD" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/AutoCAD/default.aspx" /><category term="AutoDESK" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/AutoDESK/default.aspx" /><category term="migra" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/migra/default.aspx" /><category term="vba" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/vba/default.aspx" /></entry><entry><title>DataGridView does not show Horizontal scrollbar</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2010/02/16/datagridview-does-not-show-horizontal-scrollbar.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2010/02/16/datagridview-does-not-show-horizontal-scrollbar.aspx</id><published>2010-02-16T21:25:22Z</published><updated>2010-02-16T21:25:22Z</updated><content type="html">&lt;p&gt;During a migration from a FlexGrid to a DataGridView, we encountered a situation where the HorizontalScrollBar did not show.&lt;/p&gt;  &lt;p&gt;I found many suggestions like setting a MinimumColWidth value for all columns, etc.&lt;/p&gt;  &lt;p&gt;But it wasn’t until my friend Jesus added a line like:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;mygrid.DockStyle = DockStyle.Fill &lt;/p&gt;  &lt;p&gt;that the HorizontalScrollBar appear. &lt;/p&gt;  &lt;p&gt;It might just be that the grid was too big for form but just for the record this is a possible solution.&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2088" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="C#" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/C_2300_/default.aspx" /><category term="migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/migration/default.aspx" /><category term="DataGridView" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/DataGridView/default.aspx" /><category term=".NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/.NET/default.aspx" /><category term="FlexGrid" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/FlexGrid/default.aspx" /></entry><entry><title>Escape characters for SQLLoader</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2010/02/09/escape-characters-for-sqlloader.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2010/02/09/escape-characters-for-sqlloader.aspx</id><published>2010-02-10T05:49:50Z</published><updated>2010-02-10T05:49:50Z</updated><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;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.    &lt;br /&gt;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.&lt;/p&gt;  &lt;p&gt;Let’s see an example, taken from an oracle forum:&lt;/p&gt;   &lt;pre class="csharpcode"&gt;C:\ora&amp;gt;type buyer.ctl
&lt;span class="kwrd"&gt;LOAD&lt;/span&gt; &lt;span class="kwrd"&gt;DATA&lt;/span&gt;
INFILE &lt;span class="str"&gt;&amp;#39;buyer.data&amp;#39;&lt;/span&gt;
&lt;span class="kwrd"&gt;truncate&lt;/span&gt; &lt;span class="kwrd"&gt;into&lt;/span&gt; &lt;span class="kwrd"&gt;table&lt;/span&gt; BUYER
FIELDS TERMINATED &lt;span class="kwrd"&gt;BY&lt;/span&gt; &lt;span class="str"&gt;&amp;#39;,&amp;#39;&lt;/span&gt; optionally enclosed &lt;span class="kwrd"&gt;by&lt;/span&gt; &lt;span class="str"&gt;&amp;#39;&amp;quot;&amp;#39;&lt;/span&gt; &lt;span class="kwrd"&gt;TRAILING&lt;/span&gt; NULLCOLS
(
buyer_code,
BUYER_NAME
)&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;&amp;#160;&lt;/pre&gt;

&lt;p&gt;And suppose you have data like:&lt;/p&gt;


&lt;div class="csharpcode"&gt;
  &lt;pre&gt;1,&amp;quot;XYZ IND&amp;quot;&lt;/pre&gt;

  &lt;pre class="alt"&gt;2,&amp;quot;ABC&amp;quot;&lt;/pre&gt;

  &lt;pre&gt;3,&amp;quot;XYZ ABC&amp;quot;&lt;/pre&gt;

  &lt;pre class="alt"&gt;4,&amp;quot;Your &amp;quot;offspring&amp;quot;&amp;quot;&lt;/pre&gt;

  &lt;pre&gt;5,&amp;quot;ATUL&amp;quot;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;How can you “escape” the enclosing characters. Well I found the answer in another forum: &lt;/p&gt;

&lt;p&gt;&lt;em&gt;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, &amp;#39;DON&amp;#39;&amp;#39;T&amp;#39; is stored as DON&amp;#39;T. However, if the field consists of just two delimiter characters, its value is null.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;So just use something like:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&amp;#160;&lt;/em&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;1,&amp;quot;XYZ IND&amp;quot;&lt;/pre&gt;

  &lt;pre class="alt"&gt;2,&amp;quot;ABC&amp;quot;&lt;/pre&gt;

  &lt;pre&gt;3,&amp;quot;XYZ ABC&amp;quot;&lt;/pre&gt;
  &lt;strong&gt;
    &lt;pre class="alt"&gt;4,&amp;quot;Your &amp;quot;&amp;quot;offspring&amp;quot;&amp;quot;&amp;quot;&lt;/pre&gt;
  &lt;/strong&gt;

  &lt;pre&gt;5,&amp;quot;ATUL&amp;quot;&lt;/pre&gt;

  &lt;p&gt;&lt;/p&gt;
&lt;/div&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2085" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="Java" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Java/default.aspx" /><category term="migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/migration/default.aspx" /><category term="Linc" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Linc/default.aspx" /><category term="EAE" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/EAE/default.aspx" /><category term="DMSII" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/DMSII/default.aspx" /></entry><entry><title>Easy way to see the Explain Plan in Oracle</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2010/02/03/easy-way-to-see-the-explain-plan-in-oracle.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2010/02/03/easy-way-to-see-the-explain-plan-in-oracle.aspx</id><published>2010-02-04T00:07:32Z</published><updated>2010-02-04T00:07:32Z</updated><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Linc\EAE used profiles for their queries. Well the profile information is used by our migration tool to generate indexes.    &lt;br /&gt;In Java is easy to intercept all SQL statements used by the translated application and analyze them.&lt;/p&gt;  &lt;p&gt;To analyse how a query is executed you have to study its explain plan. For go &lt;a href="http://www.adp-gmbh.ch/ora/explainplan.html"&gt;here&lt;/a&gt; an excellent guide on EXPLAIN PLAN.&lt;/p&gt;  &lt;p&gt;After you read that page, you will find useful the following function, that will shorten the lines that you have to type to see the explain plan:&lt;/p&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;create&lt;/span&gt; &lt;span class="kwrd"&gt;OR&lt;/span&gt; REPLACE &lt;span class="kwrd"&gt;function&lt;/span&gt;  ShowPlan &lt;span class="kwrd"&gt;return&lt;/span&gt; sys_refcursor
  &lt;span class="kwrd"&gt;as&lt;/span&gt;
      c_test sys_refcursor;
&lt;span class="kwrd"&gt;BEGIN&lt;/span&gt;
  &lt;span class="kwrd"&gt;open&lt;/span&gt; c_test &lt;span class="kwrd"&gt;for&lt;/span&gt; &lt;span class="kwrd"&gt;select&lt;/span&gt; 
  substr (lpad(&lt;span class="str"&gt;&amp;#39; &amp;#39;&lt;/span&gt;, &lt;span class="kwrd"&gt;level&lt;/span&gt;-1) || &lt;span class="kwrd"&gt;operation&lt;/span&gt; || &lt;span class="str"&gt;&amp;#39; (&amp;#39;&lt;/span&gt; || options || &lt;span class="str"&gt;&amp;#39;)&amp;#39;&lt;/span&gt;,1,30 ) &amp;quot;&lt;span class="kwrd"&gt;Operation&lt;/span&gt;&amp;quot;, 
  object_name &amp;quot;&lt;span class="kwrd"&gt;Object&lt;/span&gt;&amp;quot;
  &lt;span class="kwrd"&gt;from&lt;/span&gt; 
  sys.plan_table$ &lt;span class="kwrd"&gt;start&lt;/span&gt; &lt;span class="kwrd"&gt;with&lt;/span&gt; id = 0 &lt;span class="kwrd"&gt;connect&lt;/span&gt; &lt;span class="kwrd"&gt;by&lt;/span&gt; &lt;span class="kwrd"&gt;prior&lt;/span&gt; id=parent_id;
  &lt;span class="kwrd"&gt;return&lt;/span&gt; c_test;
&lt;span class="kwrd"&gt;END&lt;/span&gt;;
&lt;span class="kwrd"&gt;SQL&lt;/span&gt;&amp;gt; &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;explain plan&lt;/span&gt; &lt;span class="kwrd"&gt;for&lt;/span&gt; &lt;span class="kwrd"&gt;select&lt;/span&gt; * &lt;span class="kwrd"&gt;from&lt;/span&gt; MY_TABLE&lt;/pre&gt;

&lt;span class="kwrd"&gt;SQL&lt;/span&gt;&amp;gt; &lt;span class="kwrd"&gt;variable&lt;/span&gt; rc refcursor
&lt;span class="kwrd"&gt;SQL&lt;/span&gt;&amp;gt; &lt;span class="kwrd"&gt;exec&lt;/span&gt; :rc := testfunc()

&lt;span class="kwrd"&gt;PL/SQL&lt;/span&gt; &lt;span class="kwrd"&gt;procedure&lt;/span&gt; successfully completed.

&lt;span class="kwrd"&gt;SQL&lt;/span&gt;&amp;gt; &lt;span class="kwrd"&gt;print&lt;/span&gt; rc&lt;/pre&gt;


&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Operation&lt;/span&gt;                      &lt;span class="kwrd"&gt;Object&lt;/span&gt;
----------------------------&lt;span class="rem"&gt;-- ------------------------------&lt;/span&gt;
&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; &lt;span class="kwrd"&gt;STATEMENT&lt;/span&gt; ()
 &lt;span class="kwrd"&gt;TABLE&lt;/span&gt; ACCESS (&lt;span class="kwrd"&gt;FULL&lt;/span&gt;)           MY_TABLE&lt;/pre&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2083" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="Java" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Java/default.aspx" /><category term="ORACLE" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/ORACLE/default.aspx" /><category term="migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/migration/default.aspx" /><category term="Linc" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Linc/default.aspx" /><category term="EAE" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/EAE/default.aspx" /></entry><entry><title>Get Table Owner in Oracle</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2010/02/03/get-table-owner-in-oracle.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2010/02/03/get-table-owner-in-oracle.aspx</id><published>2010-02-03T23:40:29Z</published><updated>2010-02-03T23:40:29Z</updated><content type="html">&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;When we migrate from LINC/EAE to Oracle, the migration tool generates an schema an tables form the original ISPECS. &lt;br /&gt;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.&lt;/p&gt; &lt;p&gt;Well just as a reminder this is what is needed:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;select&lt;/span&gt; owner, table_name, tablespace_name   &lt;span class="kwrd"&gt;from&lt;/span&gt; dba_tables   &lt;span class="kwrd"&gt;where&lt;/span&gt; table_name=&lt;span class="str"&gt;&amp;#39;YOUR_TABLE&amp;#39;&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="csharpcode"&gt;This will return something as:&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;OWNER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TABLE_NAME&amp;nbsp; TABLESPACE_NAME&lt;br /&gt;------------------------------ ------------------------ ------------------------------&lt;br /&gt;THE_OWNER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MY_TABLE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; USERS
&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2082" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="ORACLE" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/ORACLE/default.aspx" /><category term="migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/migration/default.aspx" /><category term="SQL" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/SQL/default.aspx" /><category term="OWNER" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/OWNER/default.aspx" /><category term="Linc" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Linc/default.aspx" /><category term="EAE" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/EAE/default.aspx" /></entry><entry><title>Get Java Version for Oracle Stored Procedures</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2010/02/01/get-java-version-for-oracle-stored-procedures.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2010/02/01/get-java-version-for-oracle-stored-procedures.aspx</id><published>2010-02-01T17:17:16Z</published><updated>2010-02-01T17:17:16Z</updated><content type="html">&lt;p&gt;If you have to write stored procedures for oracle is important    &lt;br /&gt;to notice which Java version is supported by your Oracle Database,&lt;/p&gt;  &lt;p&gt;A common technique is create a JAVA stored procedure for that:&lt;/p&gt;  &lt;p&gt;1. Create a function with an ORACLE SQL statement like:&lt;/p&gt;  &lt;p&gt;&lt;font color="#000080" size="3" face="cour"&gt;CREATE OR REPLACE FUNCTION getJavaProperty(myprop IN VARCHAR2)     &lt;br /&gt;RETURN VARCHAR2 IS LANGUAGE JAVA      &lt;br /&gt;name ‘java.lang.System.getProperty(java.lang.String) return java.lang.String’;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;2. Once you created the function you can use it to get the version:&lt;/p&gt;  &lt;p&gt;&lt;font color="#000080" size="3" face="Courier New"&gt;SELECT getJavaProperty(‘java.version’) from dual;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;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 :)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/GetJavaVersionforOracleStoredProcedures_9EAF/image.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://blogs.artinsoft.net/public_img/GetJavaVersionforOracleStoredProcedures_9EAF/image_thumb.png" width="947" height="586" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2081" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="Java" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Java/default.aspx" /><category term="ORACLE" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/ORACLE/default.aspx" /><category term="Stored" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Stored/default.aspx" /><category term="Procedure" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Procedure/default.aspx" /></entry><entry><title>File Previewers for Outlook</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2010/01/26/file-previewers-for-outlook.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2010/01/26/file-previewers-for-outlook.aspx</id><published>2010-01-26T20:56:33Z</published><updated>2010-01-26T20:56:33Z</updated><content type="html">&lt;p&gt;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.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/FilePreviewersforOutlook_CFD4/image.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://blogs.artinsoft.net/public_img/FilePreviewersforOutlook_CFD4/image_thumb.png" width="644" height="334" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Why isn’t there a built-in preview functionality for .xml and .ZIP files?&lt;/p&gt;  &lt;p&gt;So I thought, I’m a developer I can build one. And I found an excellent article about the &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163487.aspx"&gt;File Previewers in Outlook 2007 and Windows 7&lt;/a&gt; by Stephen Toub.&lt;/p&gt;  &lt;p&gt;I just updated the project files to VS 2008 and removed the dependencies to VJ# replacing them by the SharpZipLib library.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/FilePreviewersforOutlook_CFD4/image_3.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://blogs.artinsoft.net/public_img/FilePreviewersforOutlook_CFD4/image_thumb_3.png" width="510" height="334" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;And it works well and does not require you to install anything else!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Below you can see an example of Zip File preview&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/FilePreviewersforOutlook_CFD4/image_4.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://blogs.artinsoft.net/public_img/FilePreviewersforOutlook_CFD4/image_thumb_4.png" width="361" height="372" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;And and example of XML File Preview&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/FilePreviewersforOutlook_CFD4/image_5.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://blogs.artinsoft.net/public_img/FilePreviewersforOutlook_CFD4/image_thumb_5.png" width="495" height="484" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I think is an excellent article and I can know write my own previewers every time I need them.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Download the code from &lt;a href="http://blogs.artinsoft.net/public_img/FilePreviewersCodeVS2008NoJSharpCode.zip"&gt;CODE HERE&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Download the installer from &lt;a href="http://blogs.artinsoft.net/public_img/FilePreviewersCodeVS2008NoJSharp_Installer.zip"&gt;INSTALLER HERE&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2080" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author></entry><entry><title>Get Exact Text Width C#</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2009/12/15/get-exact-text-width-c.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2009/12/15/get-exact-text-width-c.aspx</id><published>2009-12-15T19:13:00Z</published><updated>2009-12-15T19:13:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;I was recently trying to get the exact width of a string. And I found
that the Graphics.MeasureString does not give an exact result.&lt;/p&gt;&lt;p&gt;I finally found &lt;b&gt;&lt;a href="http://blogs.artinsoft.net/Members/Pierre-Arnaud" id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberProfileLink"&gt;Pierre Arnaud&lt;/a&gt;&lt;/b&gt;&lt;a href="http://www.codeproject.com/KB/GDI-plus/measurestring.aspx"&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.codeproject.com/KB/GDI-plus/measurestring.aspx"&gt; post in Code Project&lt;/a&gt;, which gave me a good explaination and solution of what was happening. &lt;/p&gt;&lt;p&gt;You can see in the image Pierre put in his post:&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.codeproject.com/KB/GDI-plus/measurestring/measurestring.gif" class="alignnone" alt="" height="39" width="366" /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;That Graphics.measurestring will return a size that might be bigger
that the actual drawn size, this is due some GDI+ details that he
explains in that post.&lt;/p&gt;&lt;p&gt;I really like the second proposed solution:&lt;/p&gt;&lt;p&gt;static public int MeasureDisplayStringWidth(Graphics graphics, string text,Font font)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Drawing.StringFormat format&amp;nbsp; = new System.Drawing.StringFormat ();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Drawing.RectangleF&amp;nbsp;&amp;nbsp; rect&amp;nbsp;&amp;nbsp;&amp;nbsp; = new System.Drawing.RectangleF(0, 0,1000, 1000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Drawing.CharacterRange[] ranges&amp;nbsp; =&amp;nbsp;{ new System.Drawing.CharacterRange(0,&amp;nbsp;text.Length) };&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Drawing.Region[]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; regions = new System.Drawing.Region[1];&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format.SetMeasurableCharacterRanges (ranges);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; regions = graphics.MeasureCharacterRanges (text, font, rect, format);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; rect&amp;nbsp;&amp;nbsp;&amp;nbsp; = regions[0].GetBounds (graphics);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (int)(rect.Right + 1.0f);&lt;br /&gt;
}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2071" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="C#" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/C_2300_/default.aspx" /><category term="migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/migration/default.aspx" /><category term="Vb6" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Vb6/default.aspx" /><category term="Width" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Width/default.aspx" /><category term="Text" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Text/default.aspx" /><category term="Exact" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Exact/default.aspx" /></entry><entry><title>ActiveX Server Migration to .NET</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2009/12/14/activex-server-migration-to-net.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2009/12/14/activex-server-migration-to-net.aspx</id><published>2009-12-14T19:01:00Z</published><updated>2009-12-14T19:01:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;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.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;In that is your case what are your options then?&lt;/p&gt;&lt;h1&gt;1. Convert those ActiveX-Exes to Windows Services.&lt;/h1&gt;&lt;p&gt;This option is simple. You modify your migrated assembly to work as a Windows Service. The easier way to do that is:&lt;/p&gt;&lt;h3&gt;a) Start Microsoft Visual Studio 2005\2008&lt;/h3&gt;&lt;h3&gt;b) Go to File\New…\Project… and Select Windows Service&lt;/h3&gt;&lt;p&gt;That will generated code like:&lt;/p&gt;&lt;p&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.Collections.Generic;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.ComponentModel;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.Data;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.Diagnostics;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.Linq;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.ServiceProcess;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.Text;&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#3366ff"&gt;&lt;span&gt;namespace &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;WindowsService1&lt;/span&gt;&lt;/font&gt;&lt;br /&gt;
{&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;font color="#3366ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;partial&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;class&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;Service1&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; : &lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#33cccc"&gt;ServiceBase&lt;/font&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;{&lt;br /&gt;
&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;font color="#3366ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; Service1()&amp;nbsp; &lt;/span&gt;{&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;InitializeComponent();&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;}&lt;br /&gt;
&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;override&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt; OnStart(&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;[] args)&amp;nbsp;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;br /&gt;
&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;override&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt; OnStop()&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;}&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;c) Add a reference to the Remoting Assemblies: System.Runtime.Remoting;&lt;/h3&gt;
&lt;h3&gt;d) Modify the previous code:&lt;/h3&gt;
&lt;p&gt;Add two using statements like:&lt;/p&gt;



&lt;p&gt;&lt;font size="1" color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.Runtime.Remoting.Channels.Http;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.Runtime.Remoting.Channels;&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;System.Runtime.Remoting;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:x-small;"&gt;Add a simple event log for tracing:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;static&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;EventLog&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#33cccc"&gt; &lt;/font&gt;evt = &lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/font&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;EventLog&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;(&lt;/span&gt;&lt;font color="#ff0000"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;“Application”&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;);&lt;br /&gt;
&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;static&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt; SVC_NAME = &lt;/span&gt;&lt;font color="#ff0000"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;“ActiveX Server Example Svc”&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;A&lt;span style="font-size:x-small;"&gt;nd modify the OnStart and OnStop methods to look like:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;override&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt; OnStart(&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;[] args)&lt;br /&gt;
{&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#33cccc"&gt;HttpChannel&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; chnl = &lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/font&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;HttpChannel&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;(1234);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;ChannelServices&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;.RegisterChannel(chnl,&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/font&gt;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;RemotingConfiguration&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;.RegisterWellKnownServiceType(&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;(&lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;MyClass&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;), &lt;/span&gt;&lt;font color="#ff0000"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;“MyClass.soap”&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;, &lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;WellKnownObjectMode&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;.Singleton);&lt;br /&gt;
&amp;nbsp;&amp;nbsp; evt.WriteEntry(SVC_NAME + ” Started”);&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;br /&gt;
}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;override&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt; OnStop() &lt;/span&gt;{ evt.WriteEntry(SVC_NAME +&lt;font color="#ff0000"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;” Stoppped”&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;); }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:x-small;"&gt;Also make sure that MyClass extends MarshalByRefClass&lt;/span&gt;&lt;/p&gt;
&lt;h1&gt;2. Convert those ActiveX-Exes using the Artinsoft ActiveX migration helpers.&lt;/h1&gt;
&lt;p&gt;&amp;nbsp;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;The code will then be changed from:&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Dim myInstance As New MyProject.MyClass&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;To the following Helper method:&lt;/p&gt;
&lt;p&gt;&lt;i&gt;myInstance&lt;/i&gt;&lt;i&gt; = &lt;/i&gt;&lt;i&gt;MyProjectFactory&lt;/i&gt;&lt;i&gt;.Create&amp;lt;&lt;/i&gt;&lt;i&gt; MyProject.&lt;/i&gt;&lt;i&gt;MyClass&lt;/i&gt;&lt;i&gt;&amp;gt;(&lt;/i&gt;&lt;i&gt;myInstance&lt;/i&gt;&lt;i&gt;);&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;And destroy calls can be changed to the following Helper method:&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;i&gt;myInstance&lt;/i&gt;&lt;i&gt;= &lt;/i&gt;&lt;i&gt;MyProjectFactory&lt;/i&gt;&lt;i&gt;.Dispose&amp;lt;&lt;/i&gt;&lt;i&gt;MyProject.&lt;/i&gt;&lt;i&gt;MyClass&lt;/i&gt;&lt;i&gt; &amp;gt;(&lt;/i&gt;&lt;i&gt; myInstance&lt;/i&gt;&lt;i&gt;);&lt;/i&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h1&gt;3. Other possible alternatives are using WFC and COM+ that I will comment in another post.&lt;/h1&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2070" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="C#" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/C_2300_/default.aspx" /><category term="ActiveX" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/ActiveX/default.aspx" /><category term="migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/migration/default.aspx" /><category term="VB.NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VB.NET/default.aspx" /><category term="Vb6" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Vb6/default.aspx" /><category term=".NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/.NET/default.aspx" /><category term="global variables" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/global+variables/default.aspx" /><category term="Out-of-process" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Out-of-process/default.aspx" /><category term="Server" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Server/default.aspx" /><category term="OLE Server" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/OLE+Server/default.aspx" /><category term="OLE" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/OLE/default.aspx" /></entry><entry><title>Return argument has an invalid type</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2009/12/10/return-argument-has-an-invalid-type.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2009/12/10/return-argument-has-an-invalid-type.aspx</id><published>2009-12-10T18:39:00Z</published><updated>2009-12-10T18:39:00Z</updated><content type="html">&lt;p&gt;When you develop applications with remoting, or in some COM + Remoting
scenarios, you could start founding very interesting exceptions.&lt;/p&gt;&lt;p&gt;We had a very unconfortable one. We had an ActiveX that is used in an
intranet&amp;nbsp;Web Page, that uses remoting to instanciate some classes in
the local network.&lt;/p&gt;&lt;p&gt;When we runned outside of the IE, everything seem to work, but running in IE it produced an exception like: &lt;/p&gt;&lt;p&gt;&lt;font size="2" color="#ff0000"&gt;&lt;code&gt;Error : Return argument has an invalid type.&lt;br /&gt;
Type&amp;nbsp; : System.InvalidCastException&lt;br /&gt;
Source: mscorlib&lt;br /&gt;
Source: at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)&lt;br /&gt;
at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)&lt;br /&gt;
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)&lt;br /&gt;
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp;amp; msgData, Int32 type)&lt;/code&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;Why??? Well what happens is simple, it is having an &lt;span style="font-weight:bold;"&gt;assembly resolution problem&lt;/span&gt;&lt;b&gt;, &lt;/b&gt;it is not being able to resolve the type.&lt;/p&gt;&lt;p&gt;We solve the problem adding something like:&lt;/p&gt;
&lt;p&gt;1. Find a place in your code to add an event like this (it could be in the Main of your program for example):&lt;/p&gt;
&lt;div&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;AppDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;.CurrentDomain.AssemblyResolve += &lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;new&lt;/span&gt; &lt;/span&gt;&lt;/font&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;ResolveEventHandler&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;(CurrentDomain_AssemblyResolve);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="2"&gt;2. Add a handler like this&lt;/font&gt;:&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;p&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;static&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#3366ff"&gt;&lt;span&gt; &lt;/span&gt;&lt;/font&gt;System.Reflection.&lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;Assembly&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#33cccc"&gt;&lt;span&gt; &lt;/span&gt;&lt;/font&gt;CurrentDomain_AssemblyResolve(&lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;object&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#3366ff"&gt;&lt;span&gt; &lt;/span&gt;&lt;/font&gt;sender, &lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;ResolveEventArgs &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;args)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;System.Reflection.&lt;/span&gt;&lt;/span&gt;&lt;font color="#33cccc"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;Assembly&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#33cccc"&gt;&lt;span&gt; &lt;/span&gt;&lt;/font&gt;assembly = &lt;/span&gt;&lt;font color="#3366ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;null&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;try&lt;/font&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;assembly = System.Reflection.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;Assembly&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;.Load(&lt;/span&gt;&lt;font color="#0000ff"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;System.Reflection.&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;AssemblyName&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;(args.Name));&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font color="#0000ff"&gt;catch&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;(&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;Exception &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;ex)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;System.Diagnostics.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;Trace&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;.WriteLine(&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;.Format(&lt;/span&gt;&lt;font color="#993300"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;“Problem with resolution of {0} : {1} {2}”&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size:x-small;"&gt;, args.Name, ex.Message, ex.StackTrace));&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;font color="#0000ff"&gt;return &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;a&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;ssembly;&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="2"&gt;Well, this worked for us, and I hope that helps you out&lt;/font&gt;.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=2068" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="C#" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/C_2300_/default.aspx" /><category term="COM" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/COM/default.aspx" /><category term="Exception" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Exception/default.aspx" /><category term="System.InvalidCastException" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/System.InvalidCastException/default.aspx" /><category term="Remoting" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Remoting/default.aspx" /><category term="Visual Basic to .NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Visual+Basic+to+.NET/default.aspx" /></entry><entry><title>Code compiles but System.IO.FileNotFound Exception is thrown</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2009/10/02/code-compiles-but-system-io-filenotfound-exception-is-thrown.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2009/10/02/code-compiles-but-system-io-filenotfound-exception-is-thrown.aspx</id><published>2009-10-02T21:04:37Z</published><updated>2009-10-02T21:04:37Z</updated><content type="html">&lt;p&gt;We have seen a situation that can be a little annoying.    &lt;br /&gt;I usually find that situation in ASP.NET projects, but it can also happen in Winforms.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;The issue is like this:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;You have a VStudio Solution&lt;/li&gt;    &lt;li&gt;You have added all the needed references&lt;/li&gt;    &lt;li&gt;All your code compiles&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="5"&gt;BUT&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When you run the application it terminates at a certain point with a    &lt;br /&gt;FileNotFound exception indicating that the assembly &lt;em&gt;blablabla&lt;/em&gt;&amp;#160; or one of its    &lt;br /&gt;dependencies could not be loaded.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font color="#800000" size="5"&gt;&lt;strong&gt;Whats hapenning!!!&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Do this:&lt;/p&gt;  &lt;p&gt;1) Look at the bin\debug or bin\release and make sure that the assembly is in those directories.&lt;/p&gt;  &lt;p&gt;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&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/Codecompil.FileNotFoundExceptionisthrown_D401/image.png"&gt;&lt;img title="image" style="border-right:0px;border-top:0px;display:inline;border-left:0px;border-bottom:0px;" height="302" alt="image" src="http://blogs.artinsoft.net/public_img/Codecompil.FileNotFoundExceptionisthrown_D401/image_thumb.png" width="322" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=1999" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="VIsual Basic .NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VIsual+Basic+.NET/default.aspx" /><category term="VB6 Migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VB6+Migration/default.aspx" /><category term="C#" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/C_2300_/default.aspx" /><category term="Visual Studio" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Visual+Studio/default.aspx" /><category term="BUGS" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/BUGS/default.aspx" /><category term="VB.NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VB.NET/default.aspx" /><category term="References" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/References/default.aspx" /><category term="VisualStudio" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VisualStudio/default.aspx" /></entry><entry><title>Mapping VBRUN.RasterOpConstants</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2009/10/01/mapping-vbrun-rasteropconstants.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2009/10/01/mapping-vbrun-rasteropconstants.aspx</id><published>2009-10-01T16:44:18Z</published><updated>2009-10-01T16:44:18Z</updated><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;&lt;strong&gt;vb Constant&lt;/strong&gt;&lt;/td&gt;        &lt;td&gt;&lt;strong&gt;Decimal Value&lt;/strong&gt;&lt;/td&gt;        &lt;td&gt;&lt;strong&gt;Hex Value&lt;/strong&gt;&lt;/td&gt;        &lt;td&gt;&lt;strong&gt;.NET&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;b&gt;&lt;i&gt;vbDstInvert&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td&gt;5570569&lt;/td&gt;        &lt;td&gt;H550009&lt;/td&gt;        &lt;td&gt;         &lt;pre&gt;System.Drawing.CopyPixelOperation.DestinationInvert&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbMergeCopy&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;12583114&lt;/td&gt;

      &lt;td&gt;HC000CA&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.MergeCopy&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbMergePaint&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;12255782&lt;/td&gt;

      &lt;td&gt;HBB0226&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.MergePaint&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbNotSrcCopy&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;3342344&lt;/td&gt;

      &lt;td&gt;H330008&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.NotSourceCopy&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbNotSrcErase&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;1114278&lt;/td&gt;

      &lt;td&gt;H1100A6&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.NotSourceErase&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbPatCopy&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;15728673&lt;/td&gt;

      &lt;td&gt;HF00021&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.PatCopy&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbPatInvert&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;5898313&lt;/td&gt;

      &lt;td&gt;H5A0049&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.PatInvert&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbPatPaint&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;16452105&lt;/td&gt;

      &lt;td&gt;HFB0A09&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.PatPaint&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbSrcAnd&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;8913094&lt;/td&gt;

      &lt;td&gt;H8800C6&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.SourceAnd&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbSrcCopy&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;13369376&lt;/td&gt;

      &lt;td&gt;HCC0020&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.SourceCopy&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbSrcErase&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;4457256&lt;/td&gt;

      &lt;td&gt;H440328&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.SourceErase&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbSrcInvert&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;6684742&lt;/td&gt;

      &lt;td&gt;H660046&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.SourceInvert&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;&lt;i&gt;vbSrcPaint&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;

      &lt;td&gt;15597702&lt;/td&gt;

      &lt;td&gt;HEE0086&lt;/td&gt;

      &lt;td&gt;
        &lt;pre&gt;System.Drawing.CopyPixelOperation.SourcePaint&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=1993" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="VB6 Migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VB6+Migration/default.aspx" /><category term="VB.NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VB.NET/default.aspx" /><category term="Vb" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Vb/default.aspx" /><category term="Vb6" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Vb6/default.aspx" /><category term="VBRUN" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VBRUN/default.aspx" /><category term="RasterOpConstants" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/RasterOpConstants/default.aspx" /></entry><entry><title>IE Explorer and Favorites folder or Special Folders in general</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2009/09/29/ie-explorer-and-favorites-folder-or-special-folders-in-general.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2009/09/29/ie-explorer-and-favorites-folder-or-special-folders-in-general.aspx</id><published>2009-09-29T15:05:48Z</published><updated>2009-09-29T15:05:48Z</updated><content type="html">&lt;p&gt;I found this email in my inbox today:&lt;/p&gt;  &lt;p&gt;&lt;font color="#808080"&gt;&lt;em&gt;“&lt;/em&gt;&lt;em&gt;Hi Mauricio,I came across a reference to your blog at :&lt;/em&gt;&lt;/font&gt;&lt;a href="http://stackoverflow.com/questions/1286746/c-open-link-in-new-tab-webbrowser-control"&gt;&lt;em&gt;&lt;font color="#0080ff"&gt;http://stackoverflow.com/questions/1286746/c-open-link-in-new-tab-webbrowser-control&lt;/font&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;font color="#808080"&gt; &lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#808080"&gt;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.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#808080"&gt;Many thanks for the valuble code and writing !&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#808080"&gt;I am &amp;quot;stuck&amp;quot; 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. &lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#808080"&gt;All my attempts to get at the Document or DomDocument by casting it to the usual mshtml.dll interfaces fail.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#808080"&gt;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. &lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#808080"&gt;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 &amp;quot;doable&amp;quot; (?) : maybe what you are seeing when IE shows a file contents is a kind of &amp;quot;virtual explorer&amp;quot; view that is not parseable.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#808080"&gt;best, Bill xxxxxx”&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;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.&lt;/p&gt;  &lt;p&gt;So I find an &lt;a href="http://www.home-server-addins.com/archives/14"&gt;useful link&lt;/a&gt; by Andreas M. if you want to look at it.&lt;/p&gt;  &lt;p&gt;In general My Favorites, Desktop, etc are special folder. So they need a trick to be able to access them.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/IEExplorerandFavoritesfolderorSpecialFol_7FED/image.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="484" alt="image" src="http://blogs.artinsoft.net/public_img/IEExplorerandFavoritesfolderorSpecialFol_7FED/image_thumb.png" width="562" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Take the code from my ExtendedWebBrowser sample published in &lt;a title="http://blogs.artinsoft.net/mrojas/archive/2009/05/01/opening-popup-in-a-newwindow.aspx" href="http://blogs.artinsoft.net/mrojas/archive/2009/05/01/opening-popup-in-a-newwindow.aspx"&gt;http://blogs.artinsoft.net/mrojas/archive/2009/05/01/opening-popup-in-a-newwindow.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;and &lt;a title="http://blogs.artinsoft.net/mrojas/archive/2009/08/07/newwindow3.aspx" href="http://blogs.artinsoft.net/mrojas/archive/2009/08/07/newwindow3.aspx"&gt;http://blogs.artinsoft.net/mrojas/archive/2009/08/07/newwindow3.aspx&lt;/a&gt; and &lt;/p&gt;  &lt;p&gt;1. Add a reference to %windir%\system32\shell32.dll&lt;/p&gt;  &lt;p&gt;2. Add a new property to the ExtendedWebBrowser like:&lt;/p&gt;   &lt;pre class="csharpcode"&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
    &lt;span class="rem"&gt;/// Returns the shell folderview object displayed in the webbrowser control.&lt;/span&gt;
    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;public&lt;/span&gt; Shell32.IShellFolderViewDual2 FolderView
    {
        get
        {
            &lt;span class="kwrd"&gt;return&lt;/span&gt; ((SHDocVw.WebBrowser)&lt;span class="kwrd"&gt;base&lt;/span&gt;.ActiveXInstance).Document
                     &lt;span class="kwrd"&gt;as&lt;/span&gt; Shell32.IShellFolderViewDual2;
        }
    }&lt;/pre&gt;

&lt;p&gt;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:&lt;/p&gt;


&lt;pre class="csharpcode"&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// Button 1_ click&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; button1_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)
        {
            Shell32.IShellFolderViewDual2 specialFolder = &lt;span class="kwrd"&gt;this&lt;/span&gt;.extendedWebBrowser1.FolderView;
            &lt;span class="kwrd"&gt;string&lt;/span&gt; folderName = specialFolder.Folder.Title;
            &lt;span class="kwrd"&gt;string&lt;/span&gt; parentFolder = specialFolder.Folder.ParentFolder.Title;
            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Shell32.ShellFolderItem f &lt;span class="kwrd"&gt;in&lt;/span&gt; specialFolder.Folder.Items())
            {
                &lt;span class="kwrd"&gt;if&lt;/span&gt; (f.IsFolder)
                    System.Diagnostics.Debug.WriteLine(&lt;span class="str"&gt;&amp;quot;Folder:&amp;quot;&lt;/span&gt; + f.Name);
                &lt;span class="kwrd"&gt;else&lt;/span&gt;
                    System.Diagnostics.Debug.WriteLine(&lt;span class="str"&gt;&amp;quot;File:&amp;quot;&lt;/span&gt; + f.Name);
            } &lt;span class="rem"&gt;// foreach&lt;/span&gt;
        } // button1_Click(sender, e)&lt;/pre&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=1986" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author><category term="C#" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/C_2300_/default.aspx" /><category term="vb6migration" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/vb6migration/default.aspx" /><category term="WebBrowser" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/WebBrowser/default.aspx" /><category term="WebBrowserControl" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/WebBrowserControl/default.aspx" /><category term="VB.NET" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/VB.NET/default.aspx" /><category term="IE" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/IE/default.aspx" /><category term="Special Folders" scheme="http://blogs.artinsoft.net/mrojas/archive/tags/Special+Folders/default.aspx" /></entry><entry><title>Using Custom Maps in the VBUC to change class names</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2009/09/28/using-custom-maps-in-the-vbuc-to-change-class-names.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2009/09/28/using-custom-maps-in-the-vbuc-to-change-class-names.aspx</id><published>2009-09-28T21:28:46Z</published><updated>2009-09-28T21:28:46Z</updated><content type="html">&lt;p&gt;The VBUC has a now a nice feature called &lt;strong&gt;&lt;em&gt;&lt;a href="http://www.vbtonet.com/vbuc-customization/custom-maps/"&gt;CustomMaps&lt;/a&gt;.&lt;/em&gt;&lt;/strong&gt;This feature allow the users to perform basic customizations in the way the target code is generated.&lt;/p&gt;  &lt;p&gt;During migration the VBUC can perform some name changes due to the Keyword restrictions in .NET.&lt;/p&gt;  &lt;p&gt;For example&amp;#160; VB.NET the some of the following keywords that cannot be used as class or variable names:&lt;/p&gt;  &lt;p&gt;Interface, Alias, And, Class, Error, Friend, Loop, MyBase, MyClass, Shared, Property&lt;/p&gt;  &lt;p&gt;See &lt;a href="http://msdn.microsoft.com/en-us/library/ksh7h19t(VS.71).aspx"&gt;here&lt;/a&gt; for a list of all VB.Net keywords. &lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;1.&lt;/strong&gt;&lt;/font&gt; Open the Artinsoft VBUC&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;2.&lt;/strong&gt;&lt;/font&gt;&amp;#160; Go to the Tools Menu\Custom Maps Editor&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="162" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb.png" width="285" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The Custom Maps Editor dialog will show up.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;3.&lt;/strong&gt;&lt;/font&gt;&amp;#160; In the Custom Maps Editor select New...&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_3.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="258" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_3.png" width="395" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;4.&lt;/strong&gt;&lt;/font&gt;&amp;#160; Type a name and description for your custom map.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_4.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="186" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_4.png" width="445" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;5.&lt;/strong&gt;&lt;/font&gt; Create some Custom Maps lines.&lt;/p&gt;  &lt;p&gt;Follow these steps:&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;font face="Tahoma" color="#800000" size="4"&gt;&lt;strong&gt;a.&lt;/strong&gt;&lt;/font&gt; First type a new SourceName. The source name is used by the VBUC to identify the element that you want to map.     &lt;br /&gt;NOTE: If you are migrating &lt;strong&gt;just one&lt;/strong&gt; Project, you just enter one custom maps line with the the source name of the class you want to rename. If your are migrating several project you must enter an additional line like &amp;lt;ProjectName&amp;gt;.&amp;lt;ClassName&amp;gt; for example Project1.Interface that is because for other projects that have Project1 as a Reference they &lt;em&gt;see&lt;/em&gt; that class as Project1.Interface and not just Interface.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_5.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="111" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_5.png" width="357" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" color="#800000" size="4"&gt;&lt;strong&gt;b.&lt;/strong&gt;&lt;/font&gt; Set the Map Type. For classes we call it a Type Map. For Functions, Subs or Properties we call it a member map.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_6.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="157" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_6.png" width="170" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" color="#800000" size="4"&gt;&lt;strong&gt;c.&lt;/strong&gt;&lt;/font&gt; We now change the New Reference Name. For a class we call a “Reference Name” to every time a the class is used to define a variable. For example each Dim x as Class1, or every appearance as a parameter, like Sub Foo(x as Class1).     &lt;br /&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_7.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="121" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_7.png" width="160" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" color="#800000" size="4"&gt;&lt;strong&gt;d.&lt;/strong&gt;&lt;/font&gt; We set the Reference Action to Modify.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_8.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="129" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_8.png" width="136" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" color="#800000" size="4"&gt;&lt;strong&gt;e.&lt;/strong&gt;&lt;/font&gt; And we set the NewDeclarationName to InterfaceClass and the DeclarationAction to Modify&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_9.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="107" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_9.png" width="124" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" color="#800000" size="4"&gt;&lt;strong&gt;f.&lt;/strong&gt;&lt;/font&gt;&amp;#160; To make sure that Keyword renamed declarations are mapped with your custom maps configuration, you have to add a line just the same as the one you had just entered but type Interface_Renamed in the SourceName&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_10.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="37" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_10.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;6.&lt;/strong&gt;&lt;/font&gt; Now you have to activate it in your profile. Click on the Edit button for profiles in the main VBUC window&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_11.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="114" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_11.png" width="165" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;7.&lt;/strong&gt;&lt;/font&gt; If you don’t have a Profile now, In the Profile Maintenance Dialog click New, and type a name for your Profile.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_12.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="328" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_12.png" width="447" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;8.&lt;/strong&gt;&lt;/font&gt; In your profile Select the custom maps configuration you just created:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_13.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="47" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_13.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Tahoma" size="5"&gt;&lt;strong&gt;9.&lt;/strong&gt;&lt;/font&gt; Now Upgrade all your code.&lt;/p&gt;  &lt;p&gt;VB6 Declarations like:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_14.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="376" alt="image" src="http://blogs.artinsoft.net/public_img/UsingCustomMapsintheVBUCtochangeclassnam_A5C2/image_thumb_14.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;will be migrated as:&lt;/p&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Option&lt;/span&gt; Strict Off
&lt;span class="kwrd"&gt;Option&lt;/span&gt; Explicit &lt;span class="kwrd"&gt;On&lt;/span&gt;
&lt;span class="kwrd"&gt;Imports&lt;/span&gt; System
&lt;span class="kwrd"&gt;Friend&lt;/span&gt; Partial &lt;span class="kwrd"&gt;Class&lt;/span&gt; Form1
    &lt;span class="kwrd"&gt;Inherits&lt;/span&gt; System.Windows.Forms.Form
    &lt;span class="rem"&gt;&amp;#39;UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load event and has a new behavior. More Information: http://www.vbtonet.com/ewis/ewi2080.aspx&lt;/span&gt;
    &lt;span class="kwrd"&gt;Private&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; Form1_Load(&lt;span class="kwrd"&gt;ByVal&lt;/span&gt; eventSender &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Object&lt;/span&gt;, &lt;span class="kwrd"&gt;ByVal&lt;/span&gt; eventArgs &lt;span class="kwrd"&gt;As&lt;/span&gt; EventArgs) &lt;span class="kwrd"&gt;Handles&lt;/span&gt; &lt;span class="kwrd"&gt;MyBase&lt;/span&gt;.Load
        &lt;span class="kwrd"&gt;Dim&lt;/span&gt; y &lt;span class="kwrd"&gt;As&lt;/span&gt; InterfaceClass
    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt;
    &lt;span class="kwrd"&gt;Sub&lt;/span&gt; Foo(&lt;span class="kwrd"&gt;ByRef&lt;/span&gt; x &lt;span class="kwrd"&gt;As&lt;/span&gt; InterfaceClass) 

    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt;
&lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Class&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;And the class definition to:&lt;/p&gt;


&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Option&lt;/span&gt; Strict Off 
&lt;span class="kwrd"&gt;Option&lt;/span&gt; Explicit &lt;span class="kwrd"&gt;On&lt;/span&gt; 
&lt;span class="kwrd"&gt;Imports&lt;/span&gt; System 
&lt;span class="kwrd"&gt;Friend&lt;/span&gt; &lt;span class="kwrd"&gt;Class&lt;/span&gt; InterfaceClass 
&lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Class&lt;/span&gt;&lt;/pre&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=1984" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author></entry><entry><title>WPF WebBrowser and the NewWindow2</title><link rel="alternate" type="text/html" href="http://blogs.artinsoft.net/mrojas/archive/2009/09/27/wpf-webbrowser-and-the-newwindow2.aspx" /><id>http://blogs.artinsoft.net/mrojas/archive/2009/09/27/wpf-webbrowser-and-the-newwindow2.aspx</id><published>2009-09-27T06:06:54Z</published><updated>2009-09-27T06:06:54Z</updated><content type="html">&lt;p&gt;To be able to catch popup windows and open them in your own window you &lt;br /&gt;have to manage WebBrowser events like NewWindow2. &lt;/p&gt; &lt;p&gt;But how do you do that in WPF?&lt;/p&gt; &lt;p&gt;Well it isn’t really that difficult. These are the steps that you have to follow:&lt;/p&gt; &lt;p&gt;1. Add a COM reference to a reference to %windir%\system32\shdocvw.dll&lt;/p&gt; &lt;p&gt;2. Add a new CodeFile to your project. Lets say CodeFile1.cs And put this code:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Runtime.InteropServices;
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid(&amp;quot;6d5140c1-7436-11ce-8034-00aa006009fa&amp;quot;)]
&lt;span class="kwrd"&gt;internal&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IServiceProvider
{

[&lt;span class="kwrd"&gt;return&lt;/span&gt;: MarshalAs(UnmanagedType.IUnknown)] 

&lt;span class="kwrd"&gt;object&lt;/span&gt; QueryService(&lt;span class="kwrd"&gt;ref&lt;/span&gt; Guid guidService, &lt;span class="kwrd"&gt;ref&lt;/span&gt; Guid riid);

}

&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;/pre&gt;
&lt;p&gt;3. To make an easy example. Lets assume we have a very simple window like:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://farm4.static.flickr.com/3454/3958116810_e6a8e85195.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;And in that form we need some code like this:&lt;/p&gt;&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; button1_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
        {
            Guid SID_SWebBrowserApp = &lt;br /&gt;                          &lt;span class="kwrd"&gt;new&lt;/span&gt; Guid(&lt;span class="str"&gt;&amp;quot;0002DF05-0000-0000-C000-000000000046&amp;quot;&lt;/span&gt;);
            IServiceProvider serviceProvider = &lt;br /&gt;                (IServiceProvider)myWebBrowser.Document; //&amp;lt;—It seams that you need to &lt;br /&gt;                                                         // navigate first to initialize this

            Guid serviceGuid = SID_SWebBrowserApp;

            Guid iid = &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(SHDocVw.IWebBrowser2).GUID;
            //Here we will get a reference to the IWebBrowser2 interface
            SHDocVw.IWebBrowser2 myWebBrowser2 = &lt;br /&gt;                   (SHDocVw.IWebBrowser2) &lt;br /&gt;                   serviceProvider.QueryService(&lt;span class="kwrd"&gt;ref&lt;/span&gt; serviceGuid, &lt;span class="kwrd"&gt;ref&lt;/span&gt; iid);&lt;/pre&gt;&lt;pre class="csharpcode"&gt;            //To hook events we just need to do these casts
            SHDocVw.DWebBrowserEvents_Event wbEvents = &lt;br /&gt;                 (SHDocVw.DWebBrowserEvents_Event)myWebBrowser2;
            SHDocVw.DWebBrowserEvents2_Event wbEvents2 = &lt;br /&gt;                  (SHDocVw.DWebBrowserEvents2_Event)myWebBrowser2;&lt;/pre&gt;&lt;pre class="csharpcode"&gt;            //Adding event handlers is now very simple
            wbEvents.NewWindow += &lt;br /&gt;               &lt;span class="kwrd"&gt;new&lt;/span&gt; SHDocVw.DWebBrowserEvents_NewWindowEventHandler(wbEvents_NewWindow);&lt;/pre&gt;&lt;pre class="csharpcode"&gt;            wbEvents2.NewWindow2 += &lt;br /&gt;               &lt;span class="kwrd"&gt;new&lt;/span&gt; SHDocVw.DWebBrowserEvents2_NewWindow2EventHandler(wbEvents2_NewWindow2);

        }

        &lt;span class="kwrd"&gt;void&lt;/span&gt; wbEvents2_NewWindow2(&lt;span class="kwrd"&gt;ref&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; ppDisp, &lt;span class="kwrd"&gt;ref&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; Cancel)
        {
            //If you want make popup windows to open in your own window&lt;br /&gt;            // you need to assign the ppDisp to the .Application of &lt;br /&gt;            // the WebBrowser in your window&lt;/pre&gt;&lt;pre class="csharpcode"&gt;            Window1 wnd = &lt;span class="kwrd"&gt;new&lt;/span&gt; Window1();
            wnd.Show();&lt;br /&gt;            //Just navigate to make sure .Document is initilialized
            wnd.myWebBrowser.Navigate(&lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;&amp;quot;about:blank&amp;quot;&lt;/span&gt;));             &lt;br /&gt;            Guid SID_SWebBrowserApp = &lt;span class="kwrd"&gt;new&lt;/span&gt; Guid(&lt;span class="str"&gt;&amp;quot;0002DF05-0000-0000-C000-000000000046&amp;quot;&lt;/span&gt;);
            IServiceProvider serviceProvider = (IServiceProvider)wnd.myWebBrowser.Document;

            Guid serviceGuid = SID_SWebBrowserApp;

            Guid iid = &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(SHDocVw.IWebBrowser2).GUID;

            SHDocVw.IWebBrowser2 myWebBrowser2 = (SHDocVw.IWebBrowser2)serviceProvider.QueryService(&lt;span class="kwrd"&gt;ref&lt;/span&gt; serviceGuid, &lt;span class="kwrd"&gt;ref&lt;/span&gt; iid);

            ppDisp = myWebBrowser2.Application;
        }

        &lt;span class="kwrd"&gt;void&lt;/span&gt; wbEvents_NewWindow(&lt;span class="kwrd"&gt;string&lt;/span&gt; URL, &lt;span class="kwrd"&gt;int&lt;/span&gt; Flags, &lt;span class="kwrd"&gt;string&lt;/span&gt; TargetFrameName, &lt;span class="kwrd"&gt;ref&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; PostData, &lt;span class="kwrd"&gt;string&lt;/span&gt; Headers, &lt;span class="kwrd"&gt;ref&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; Processed)
        {
            MessageBox.Show(URL);
        }

        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; button2_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
        {
            myWebBrowser.Navigate(&lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;&amp;quot;file://D:/MyProjects/ExtendedBrowserExample_v2/test0.htm&amp;quot;&lt;/span&gt;)); 
        }
&lt;/pre&gt;
&lt;p&gt;Now you can manage your popupwindows:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2570/3957339983_e9bc0a3c78.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can download the test application from &lt;a href="http://blogs.artinsoft.net/public_img/WpfWebBrowserNewWindowEvent.zip"&gt;HERE&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.artinsoft.net/aggbug.aspx?PostID=1982" width="1" height="1"&gt;</content><author><name>Mrojas</name><uri>http://blogs.artinsoft.net/members/Mrojas.aspx</uri></author></entry></feed>