<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Chlankboot Journal &#187; Programmation</title>
	<atom:link href="http://www.chlankboot.com/blog/archives/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.chlankboot.com/blog</link>
	<description>There are only 10 types of persons in this world : Those who understand binary and thos who don&#039;t</description>
	<lastBuildDate>Mon, 30 Aug 2010 20:45:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>A Convenient Way to Fill-In Word Custom Properties</title>
		<link>http://www.chlankboot.com/blog/archives/1030/a-convenient-way-to-fill-in-word-custom-properties</link>
		<comments>http://www.chlankboot.com/blog/archives/1030/a-convenient-way-to-fill-in-word-custom-properties#comments</comments>
		<pubDate>Sat, 07 Mar 2009 12:47:57 +0000</pubDate>
		<dc:creator>Walid</dc:creator>
				<category><![CDATA[Programmation]]></category>
		<category><![CDATA[Un Monde Digital]]></category>
		<category><![CDATA[Custom property]]></category>
		<category><![CDATA[Macro]]></category>
		<category><![CDATA[Word]]></category>

		<guid isPermaLink="false">http://www.chlankboot.com/blog/?p=1030</guid>
		<description><![CDATA[In a previous post, we discussed an easy way to fill-in forms and reports having recurrent data with the help of custom properties and fields. Thanks to a comment from Wayne, I found out that filling the actual value of the fields with the "conventional" method (the use of the default Word form) was not so handy and has big disadvantages ...


Related posts:<ol><li><a href='http://www.chlankboot.com/blog/archives/1014/word-custom-properties-how-to-improve-productivity' rel='bookmark' title='Permanent Link: Word Custom Properties: How to Improve Productivity'>Word Custom Properties: How to Improve Productivity</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text' rel='bookmark' title='Permanent Link: ChlankMail: Extract Email Addresses From Any Text'>ChlankMail: Extract Email Addresses From Any Text</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/232/iso-9001-2k-mandatory-documents' rel='bookmark' title='Permanent Link: ISO 9001:2000 Mandatory Documents'>ISO 9001:2000 Mandatory Documents</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.chlankboot.com%2Fblog%2Farchives%2F1030%2Fa-convenient-way-to-fill-in-word-custom-properties"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.chlankboot.com%2Fblog%2Farchives%2F1030%2Fa-convenient-way-to-fill-in-word-custom-properties&amp;source=chlankboot&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;"><span class="drop_cap">I</span>n a <a href="http://www.chlankboot.com/blog/archives/1014/word-custom-properties-how-to-improve-productivity" target="_blank">previous post</a>, we discussed an easy way to fill-in forms and reports having recurrent data with the help of custom properties and fields. Thanks to a comment from Wayne, I found out that filling the actual value of the fields with the &#8220;conventional&#8221; method (the use of the default Word form) was not so handy and has big disadvantages.</p>
<p><span id="more-1030"></span></p>
<p style="text-align: justify;">The biggest problem was that we cannot enter a multiline text in the dedicated textbox, even with pasting. I tried the use of the solution with a complicated report and I was a pain, especially when you have to paste the values from another Word window, because the custom properties form is application modal and you have to close it each time to switch to another open word document.</p>
<p style="text-align: justify;">The easiest way to do this is by the use of macros. No it&#8217;s not complicated! So wait a minute and let me finish: all you will have to do is pasting the code below in your document, so don&#8217;t worry.</p>
<p style="text-align: justify;">Original code <a href="http://word.mvps.org/faqs/macrosvba/MixedDocProps.htm" target="_blank">and much more can be viewed here</a>; I just added a small procedure (<em>FillDocument</em>) at the end where user can modify the values of variables associated to the custom properties. To enter a multiline property value, simply use the <em>(vbCrLf)</em><em> </em>constant as below. The code will work with the previous post example:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">' Code originally published on:</span>
<span style="color: #008080; font-style: italic;">' http://word.mvps.org/faqs/macrosvba/MixedDocProps.htm</span>
&nbsp;
&nbsp;
<span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Sub</span> WriteProp<span style="color: #000000;">&#40;</span>sPropName <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> sValue <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, _
      <span style="color: #FF8000;">Optional</span> lType <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Long</span> <span style="color: #008000;">=</span> msoPropertyTypeString<span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">' In the above declaration,</span>
<span style="color: #008080; font-style: italic;">' &quot;Optional lType As Long = msoPropertyTypeString&quot; means</span>
<span style="color: #008080; font-style: italic;">' that if the Document Property's Type is Text, we don't need</span>
<span style="color: #008080; font-style: italic;">' to include the lType argument when we call the procedure;</span>
<span style="color: #008080; font-style: italic;">' but if it's any other Prpperty Type (e.g. date) then we do</span>
&nbsp;
<span style="color: #0600FF;">Dim</span> bCustom <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Boolean</span>
&nbsp;
  <span style="color: #FF8000;">On</span> <span style="color: #FF8000;">Error</span> GoTo ErrHandlerWriteProp
&nbsp;
  <span style="color: #008080; font-style: italic;">'Try to write the value sValue to the custom documentproperties</span>
  <span style="color: #008080; font-style: italic;">'If the customdocumentproperty does not exists, an error will occur</span>
  <span style="color: #008080; font-style: italic;">'and the code in the errorhandler will run</span>
  ActiveDocument.<span style="color: #0000FF;">BuiltInDocumentProperties</span><span style="color: #000000;">&#40;</span>sPropName<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> <span style="color: #008000;">=</span> sValue
  <span style="color: #008080; font-style: italic;">'Quit this routine</span>
  <span style="color: #0600FF;">Exit</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
Proceed:
  <span style="color: #008080; font-style: italic;">'We know now that the property is not a builtin documentproperty,</span>
  <span style="color: #008080; font-style: italic;">'but a custom documentproperty, so bCustom = True</span>
  bCustom <span style="color: #008000;">=</span> <span style="color: #0600FF;">True</span>
&nbsp;
Custom:
  <span style="color: #008080; font-style: italic;">'Try to set the value for the customproperty sPropName to sValue</span>
  <span style="color: #008080; font-style: italic;">'An error will occur if the documentproperty doesn't exist yet</span>
  <span style="color: #008080; font-style: italic;">'and the code in the errorhandler will take over</span>
  ActiveDocument.<span style="color: #0000FF;">CustomDocumentProperties</span><span style="color: #000000;">&#40;</span>sPropName<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Value</span> <span style="color: #008000;">=</span> sValue
  <span style="color: #0600FF;">Exit</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
AddProp:
  <span style="color: #008080; font-style: italic;">'We came here from the errorhandler, so know we know that</span>
  <span style="color: #008080; font-style: italic;">'property sPropName is not a built-in property and that there's</span>
  <span style="color: #008080; font-style: italic;">'no custom property with this name</span>
  <span style="color: #008080; font-style: italic;">'Add it</span>
  <span style="color: #FF8000;">On</span> <span style="color: #FF8000;">Error</span> <span style="color: #FF8000;">Resume</span> <span style="color: #FF8000;">Next</span>
  ActiveDocument.<span style="color: #0000FF;">CustomDocumentProperties</span>.<span style="color: #0000FF;">Add</span> Name:<span style="color: #008000;">=</span>sPropName, _
    LinkToContent:<span style="color: #008000;">=</span><span style="color: #0600FF;">False</span>, Type:<span style="color: #008000;">=</span>lType, Value:<span style="color: #008000;">=</span>sValue
&nbsp;
  <span style="color: #0600FF;">If</span> <span style="color: #008000;">Err</span> <span style="color: #FF8000;">Then</span>
    <span style="color: #008080; font-style: italic;">'If we still get an error, the value isn't valid for the Property Type</span>
    <span style="color: #008080; font-style: italic;">'e,g an invalid date was used</span>
    <span style="color: #008000;">Debug</span>.<span style="color: #FF8000;">Print</span> <span style="color: #808080;">&quot;The Property &quot;</span> <span style="color: #008000;">&amp;</span> <span style="color: #0600FF;">Chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span> _
     sPropName <span style="color: #008000;">&amp;</span> <span style="color: #0600FF;">Chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span> <span style="color: #808080;">&quot; couldn't be written, because &quot;</span> <span style="color: #008000;">&amp;</span> _
     <span style="color: #0600FF;">Chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span> sValue <span style="color: #008000;">&amp;</span> <span style="color: #0600FF;">Chr</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">34</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span> _
     <span style="color: #808080;">&quot; is not a valid value for the property type&quot;</span>
  <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
  <span style="color: #0600FF;">Exit</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
ErrHandlerWriteProp:
  <span style="color: #0600FF;">Select</span> <span style="color: #0600FF;">Case</span> <span style="color: #008000;">Err</span>
    <span style="color: #0600FF;">Case</span> <span style="color: #FF8000;">Else</span>
   <span style="color: #008080; font-style: italic;">'Clear the error</span>
   <span style="color: #008000;">Err</span>.<span style="color: #0000FF;">Clear</span>
   <span style="color: #008080; font-style: italic;">'bCustom is a boolean variable, if the code jumps to this</span>
   <span style="color: #008080; font-style: italic;">'errorhandler for the first time, the value for bCustom is False</span>
   <span style="color: #0600FF;">If</span> <span style="color: #804040;">Not</span> bCustom <span style="color: #FF8000;">Then</span>
     <span style="color: #008080; font-style: italic;">'Continue with the code after the label Proceed</span>
     <span style="color: #FF8000;">Resume</span> Proceed
   <span style="color: #FF8000;">Else</span>
     <span style="color: #008080; font-style: italic;">'The errorhandler was executed before because the value for</span>
     <span style="color: #008080; font-style: italic;">'the variable bCustom is True, therefor we know that the</span>
     <span style="color: #008080; font-style: italic;">'customdocumentproperty did not exist yet, jump to AddProp,</span>
     <span style="color: #008080; font-style: italic;">'where the property will be made</span>
     <span style="color: #FF8000;">Resume</span> AddProp
   <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
  <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Select</span>
&nbsp;
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
<span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Sub</span> FillDocument<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #0600FF;">Dim</span> Var_Sender_Name, Var_Recipient_Name, Var_Customer_Number, _
Var_Location  <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
&nbsp;
<span style="color: #008080; font-style: italic;">' This is the part to be edited</span>
Var_Sender_Name <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;Mr. Axel Rose&quot;</span>
Var_Recipient_Name <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;Mr.John Bon Jovi&quot;</span>
Var_Customer_Number <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;ANYTHING0037857&quot;</span>
Var_Location <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;Here we go, the first line,&quot;</span> <span style="color: #008000;">&amp;</span> vbCrLf <span style="color: #008000;">&amp;</span> _
<span style="color: #808080;">&quot;This is the second line,&quot;</span> <span style="color: #008000;">&amp;</span> vbCrLf <span style="color: #008000;">&amp;</span> <span style="color: #808080;">&quot;This is a third line.&quot;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">' Add as many calls as the properties you have</span>
<span style="color: #0600FF;">Call</span> WriteProp<span style="color: #000000;">&#40;</span>sPropName:<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Sender_Name&quot;</span>, sValue:<span style="color: #008000;">=</span>Var_Sender_Name, _
lType:<span style="color: #008000;">=</span>msoPropertyTypeString<span style="color: #000000;">&#41;</span>
<span style="color: #0600FF;">Call</span> WriteProp<span style="color: #000000;">&#40;</span>sPropName:<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Recipient_Name&quot;</span>, sValue:<span style="color: #008000;">=</span>Var_Recipient_Name, _
lType:<span style="color: #008000;">=</span>msoPropertyTypeString<span style="color: #000000;">&#41;</span>
<span style="color: #0600FF;">Call</span> WriteProp<span style="color: #000000;">&#40;</span>sPropName:<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Customer_Number&quot;</span>, sValue:<span style="color: #008000;">=</span>Var_Customer_Number, _
lType:<span style="color: #008000;">=</span>msoPropertyTypeString<span style="color: #000000;">&#41;</span>
<span style="color: #0600FF;">Call</span> WriteProp<span style="color: #000000;">&#40;</span>sPropName:<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Location&quot;</span>, sValue:<span style="color: #008000;">=</span>Var_Location, _
lType:<span style="color: #008000;">=</span>msoPropertyTypeString<span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

<p style="text-align: justify;">You can improve this code by creating a form with convenient textboxes for all the fields and a validation button. You can even use InfoPath and XML to do the same (too complicated for me), but right now this is simple and above all it&#8217;s working, so &#8230; smile.</p>


<p>Related posts:<ol><li><a href='http://www.chlankboot.com/blog/archives/1014/word-custom-properties-how-to-improve-productivity' rel='bookmark' title='Permanent Link: Word Custom Properties: How to Improve Productivity'>Word Custom Properties: How to Improve Productivity</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text' rel='bookmark' title='Permanent Link: ChlankMail: Extract Email Addresses From Any Text'>ChlankMail: Extract Email Addresses From Any Text</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/232/iso-9001-2k-mandatory-documents' rel='bookmark' title='Permanent Link: ISO 9001:2000 Mandatory Documents'>ISO 9001:2000 Mandatory Documents</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.chlankboot.com/blog/archives/1030/a-convenient-way-to-fill-in-word-custom-properties/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ChlankMail: Extract Email Addresses From Any Text</title>
		<link>http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text</link>
		<comments>http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text#comments</comments>
		<pubDate>Wed, 21 Jan 2009 10:52:51 +0000</pubDate>
		<dc:creator>Walid</dc:creator>
				<category><![CDATA[Programmation]]></category>
		<category><![CDATA[ChlankMail]]></category>
		<category><![CDATA[Mail Extraction]]></category>

		<guid isPermaLink="false">http://www.chlankboot.com/blog/?p=690</guid>
		<description><![CDATA[Topic : 	A program that extracts email addresses from any text
Sujet :		Un programme qui extrait les adresses mail depuis un texte quelconque

Audience : 	Programmers, email collectors
Audience :	Programmeurs, collectionneurs d'emails

Summary :	Subject is self explaining, program is supplied with source code
Résumé :	Le sujet s'exprime par lui même, fourni avec code source


Related posts:<ol><li><a href='http://www.chlankboot.com/blog/archives/23/me-net-and-the-others' rel='bookmark' title='Permanent Link: Do you like the Framework?'>Do you like the Framework?</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/1030/a-convenient-way-to-fill-in-word-custom-properties' rel='bookmark' title='Permanent Link: A Convenient Way to Fill-In Word Custom Properties'>A Convenient Way to Fill-In Word Custom Properties</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/192/disabling-texbox-context-menu' rel='bookmark' title='Permanent Link: Using WndProc to Disabe Text Box Context Menu'>Using WndProc to Disabe Text Box Context Menu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.chlankboot.com%2Fblog%2Farchives%2F690%2Fchlankmail-extract-mail-addresses-from-text"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.chlankboot.com%2Fblog%2Farchives%2F690%2Fchlankmail-extract-mail-addresses-from-text&amp;source=chlankboot&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">Sometimes you need to extract email addresses from text or documents or even from emails like “you will stay luckless for 3 years, if you do not forward this mail to 10 of your friends”. Task is easy if you have few couples of addresses, but once it becomes to tens or sometimes more, that would be a pain in the ass.</p>
<p><span id="more-690"></span></p>
<p style="text-align: center;"><img class="attachment wp-att-701 centered" src="http://www.chlankboot.com/blog/wp-content/uploads/2009/01/chlankmail.jpg" alt="" width="540" height="332" /></p>
<p>What I’m proposing here is a program that does the job on the fly; you just need to copy the text and paste it, then click a button. Here is the source:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">    <span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> cmd_chlank_Click<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sender <span style="color: #FF8000;">As</span> System.<span style="color: #FF0000;">Object</span>,_
    <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">EventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Handles</span> cmd_chlank.<span style="color: #0000FF;">Click</span>
        <span style="color: #0600FF;">If</span> Source.<span style="color: #0000FF;">Text</span> &lt;&gt; <span style="color: #808080;">&quot;&quot;</span> <span style="color: #FF8000;">Then</span>
            <span style="color: #0600FF;">Dim</span> Sep <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot; =&lt;&gt;()%$#!*^[]{}/\'&quot;</span> <span style="color: #008000;">+</span> vbCrLf <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;&quot;</span><span style="color: #808080;">&quot;&quot;</span>
            <span style="color: #0600FF;">Dim</span> SS <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> Source.<span style="color: #0000FF;">Text</span>
            <span style="color: #0600FF;">Dim</span> DT <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
            <span style="color: #0600FF;">Dim</span> LeftStr <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
            <span style="color: #0600FF;">Dim</span> RightStr <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
            <span style="color: #0600FF;">Dim</span> P <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span>
            <span style="color: #0600FF;">Dim</span> Pos, PLeft, PRight <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>
            <span style="color: #0600FF;">Dim</span> DetectedMail <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
            <span style="color: #0600FF;">Dim</span> MailsCount <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
            Destination.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
            <span style="color: #0600FF;">Do</span>
                Pos <span style="color: #008000;">=</span> <span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span>P, SS, <span style="color: #808080;">&quot;@&quot;</span><span style="color: #000000;">&#41;</span>
                <span style="color: #0600FF;">If</span> Pos <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span> GoTo TakeMeOut
                PLeft <span style="color: #008000;">=</span> Pos
                PRight <span style="color: #008000;">=</span> Pos
                <span style="color: #0600FF;">Do</span>
                    PLeft <span style="color: #008000;">=</span> PLeft <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span>
                    <span style="color: #0600FF;">If</span> Sep.<span style="color: #0000FF;">Contains</span><span style="color: #000000;">&#40;</span>SS.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span>PLeft, <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
                        LeftStr <span style="color: #008000;">=</span> SS.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span>PLeft <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span>, Pos <span style="color: #008000;">-</span> PLeft <span style="color: #008000;">-</span> <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>
                        PLeft <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
                    <span style="color: #FF8000;">Else</span>
                        <span style="color: #0600FF;">If</span> PLeft <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span> LeftStr <span style="color: #008000;">=</span> SS.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>, Pos <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span>
                    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
                <span style="color: #0600FF;">Loop</span> Until PLeft <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
                <span style="color: #0600FF;">Do</span>
                    PRight <span style="color: #008000;">=</span> PRight <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span>
                    <span style="color: #0600FF;">If</span> PRight <span style="color: #008000;">=</span> SS.<span style="color: #0000FF;">Length</span> <span style="color: #FF8000;">Then</span>
                        RightStr <span style="color: #008000;">=</span> SS.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span>Pos, PRight <span style="color: #008000;">-</span> Pos<span style="color: #000000;">&#41;</span>
                        DetectedMail <span style="color: #008000;">=</span> LeftStr <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;@&quot;</span> <span style="color: #008000;">+</span> RightStr
                        <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span>DT, DetectedMail<span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
                            DT <span style="color: #008000;">=</span> DT <span style="color: #008000;">+</span> DetectedMail <span style="color: #008000;">+</span> vbCrLf
                            MailsCount <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span>
                        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
                        GoTo TakeMeOut
                    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
                    <span style="color: #0600FF;">If</span> Sep.<span style="color: #0000FF;">Contains</span><span style="color: #000000;">&#40;</span>SS.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span>PRight, <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
                        RightStr <span style="color: #008000;">=</span> SS.<span style="color: #0000FF;">Substring</span><span style="color: #000000;">&#40;</span>Pos, PRight <span style="color: #008000;">-</span> Pos<span style="color: #000000;">&#41;</span>
                        P <span style="color: #008000;">=</span> PRight <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span>
                        PRight <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
                    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
                <span style="color: #0600FF;">Loop</span> Until PRight <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
                DetectedMail <span style="color: #008000;">=</span> LeftStr <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;@&quot;</span> <span style="color: #008000;">+</span> RightStr
                <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">InStr</span><span style="color: #000000;">&#40;</span>DT, DetectedMail<span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
                    DT <span style="color: #008000;">=</span> DT <span style="color: #008000;">+</span> DetectedMail <span style="color: #008000;">+</span> vbCrLf
                    MailsCount <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span>
                <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
            <span style="color: #0600FF;">Loop</span> <span style="color: #0600FF;">While</span> Pos &lt;&gt; <span style="color: #FF0000;">0</span>
TakeMeOut:
            Destination.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> DT
            lb_MailsCount.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> MailsCount
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

<p style="text-align: justify;">Code is not optimized I know, it was a very quick thing, but you can share your comments here to improve it and make it more compatible with RFC&#8217;s. You are free to do whatever you want with this code and with the program, it would be nice if you drop me a line if you find it useful but I’m not responsible of the use you will make of (yeah, I mean: DO NOT USE IT TO SPAM PEOPLE).</p>
<ul>
<li>Download the program <a href="http://www.nineshare.com/dl/4kvevzu2lot4/chlankmail.exe.rar" target="_blank">here</a>.</li>
<li>Download the complete VB.NET project (<a href="http://www.nineshare.com/dl/jlzc6p32kn8u/chlankmail.rar" target="_blank">source code</a>)</li>
<li>To run the program, you need <a href="http://www.microsoft.com/downloads/details.aspx?familyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&amp;displaylang=en" target="_blank">Microsoft .Net Framework V2.0</a></li>
</ul>
<ul></ul>


<p>Related posts:<ol><li><a href='http://www.chlankboot.com/blog/archives/23/me-net-and-the-others' rel='bookmark' title='Permanent Link: Do you like the Framework?'>Do you like the Framework?</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/1030/a-convenient-way-to-fill-in-word-custom-properties' rel='bookmark' title='Permanent Link: A Convenient Way to Fill-In Word Custom Properties'>A Convenient Way to Fill-In Word Custom Properties</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/192/disabling-texbox-context-menu' rel='bookmark' title='Permanent Link: Using WndProc to Disabe Text Box Context Menu'>Using WndProc to Disabe Text Box Context Menu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using WndProc to Disabe Text Box Context Menu</title>
		<link>http://www.chlankboot.com/blog/archives/192/disabling-texbox-context-menu</link>
		<comments>http://www.chlankboot.com/blog/archives/192/disabling-texbox-context-menu#comments</comments>
		<pubDate>Sat, 08 Nov 2008 21:24:34 +0000</pubDate>
		<dc:creator>Walid</dc:creator>
				<category><![CDATA[Programmation]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.chlankboot.com/blog/?p=192</guid>
		<description><![CDATA[Whether you wanted to forbid users to paste like crazy within textboxes or you wanted to create your own, the default textbox context menu should be deactivated. It&#8217;s a good example of overriding the default WndProc method (which corresponds to the WindowProc windows function) and filtering the incoming messages. For our example we will listen [...]


Related posts:<ol><li><a href='http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text' rel='bookmark' title='Permanent Link: ChlankMail: Extract Email Addresses From Any Text'>ChlankMail: Extract Email Addresses From Any Text</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.chlankboot.com%2Fblog%2Farchives%2F192%2Fdisabling-texbox-context-menu"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.chlankboot.com%2Fblog%2Farchives%2F192%2Fdisabling-texbox-context-menu&amp;source=chlankboot&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;"><span class="drop_cap">W</span>hether you wanted to forbid users to paste like crazy within textboxes or you wanted to create your own, the default textbox context menu should be deactivated. It&#8217;s a good example of overriding the default <strong>WndProc </strong> method (which corresponds to the WindowProc windows function) and filtering the incoming messages.  For our example we will listen and wait for the WM_CONTEXTMENU, then we will simply cancel it, here is VB.NET sample, the code below should be used typically in a custom control (text box) definition class:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">Protected <span style="color: #FF8000;">Overrides</span> <span style="color: #0600FF;">Sub</span> WndProc<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByRef</span> m <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">If</span> m.<span style="color: #0000FF;">Msg</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&amp;</span>amp;H7B <span style="color: #FF8000;">Then</span> <span style="color: #008080; font-style: italic;">'WM_CONTEXTMENU</span>
        <span style="color: #FF8000;">Return</span> <span style="color: #008080; font-style: italic;">'Do nothing</span>
    <span style="color: #FF8000;">Else</span>
        <span style="color: #0600FF;">Call</span> <span style="color: #FF8000;">MyBase</span>.<span style="color: #0000FF;">WndProc</span><span style="color: #000000;">&#40;</span>m<span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">'Process the message normally</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

<p style="text-align: justify;">Here is another example written in C# and taken from the <a href="http://msdn.microsoft.com/fr-fr/library/system.windows.forms.control.wndproc(vs.80).aspx">MSDN community</a>, it uses the WM_NCHITTEST to allow moving a form directly from the client area, making windows &#8220;think&#8221; that the click occurred on the title bar:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> WM_NCHITTEST <span style="color: #008000;">=</span> 0x84<span style="color: #008000;">;</span>
<span style="color: #0600FF;">private</span> <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> HTCAPTION <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">private</span> <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">int</span> HTCLIENT <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> WndProc<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ref</span> Message m<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">WndProc</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ref</span> m<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>m.<span style="color: #0000FF;">Msg</span> <span style="color: #008000;">==</span> WM_NCHITTEST <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> m.<span style="color: #0000FF;">Result</span> <span style="color: #008000;">==</span> <span style="color: #008000;">new</span> IntPtr<span style="color: #000000;">&#40;</span>HTCLIENT<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        m.<span style="color: #0000FF;">Result</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> IntPtr<span style="color: #000000;">&#40;</span>HTCAPTION<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>



<p>Related posts:<ol><li><a href='http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text' rel='bookmark' title='Permanent Link: ChlankMail: Extract Email Addresses From Any Text'>ChlankMail: Extract Email Addresses From Any Text</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.chlankboot.com/blog/archives/192/disabling-texbox-context-menu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do you like the Framework?</title>
		<link>http://www.chlankboot.com/blog/archives/23/me-net-and-the-others</link>
		<comments>http://www.chlankboot.com/blog/archives/23/me-net-and-the-others#comments</comments>
		<pubDate>Fri, 22 Feb 2008 08:42:57 +0000</pubDate>
		<dc:creator>Walid</dc:creator>
				<category><![CDATA[Programmation]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.chlankboot.com/blog/?p=23</guid>
		<description><![CDATA[Few years ago, a debate arose around Microsoft&#8217;s new born CLR (Common Language Runtime) and .Net framework. Opinions were actually divided on the reliability of the platform, the robustness and performance of the programs written in managed code but it was still early to take conclusions. I loved the object oriented model approach that was [...]


Related posts:<ol><li><a href='http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text' rel='bookmark' title='Permanent Link: ChlankMail: Extract Email Addresses From Any Text'>ChlankMail: Extract Email Addresses From Any Text</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/1030/a-convenient-way-to-fill-in-word-custom-properties' rel='bookmark' title='Permanent Link: A Convenient Way to Fill-In Word Custom Properties'>A Convenient Way to Fill-In Word Custom Properties</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.chlankboot.com%2Fblog%2Farchives%2F23%2Fme-net-and-the-others"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.chlankboot.com%2Fblog%2Farchives%2F23%2Fme-net-and-the-others&amp;source=chlankboot&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;"><span class="drop_cap">F</span>ew years ago, a debate arose around Microsoft&#8217;s new born CLR (Common Language Runtime) and .Net framework. Opinions were actually divided on the reliability of the platform, the robustness and performance of the programs written in managed code but it was still early to take conclusions.</p>
<p style="text-align: justify;">I loved the object oriented model approach that was supposed to get rid of all the mess that VB6 Sunday programmers were spreading all around. I liked the very nice and intuitive Visual Studio IDE, the brand new elegant C# language, and later I loved the power of managed code within stored procedures of SQL server 2005.</p>
<p style="text-align: justify;">My first program with Visual Studio was an ERP for a small company; it was an SQL server 2000 DBMS based solution. Development lasted for six months and I was looking in parallel for a reliable way to protect my soft. That was not really a critical issue because the product was so customized to the client that I hardly imagine another company using it. Anyway, I went through all imaginable protection schemes for that damned executable, and I was surprised to see that none of these protections will take more than one hour to be broken.</p>
<p style="text-align: justify;">At that time, I did not understand why Microsoft is replacing our old processor machine opcodes by this, why with this CLR virtual machine programs are so poorly protected and the first coming hacker is able to see MY source? Why do people have to pay for Visual Studio, for an obfuscator and for a packer &#8230; to protect THEIR OWN code?</p>
<h3>The test:</h3>
<p style="text-align: justify;">Today, while trying an <a href="http://www.leconjugueur.com/">amzing french conjugation program</a>, i tried to see what protection scheme is used by the shareware and guess what: it was a .Net program and here is the serial number generation routines that I got with Refractor:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> B21<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> nom <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>
<span style="color: #0600FF;">Dim</span> num <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>
<span style="color: #0600FF;">Dim</span> num2 <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span>
<span style="color: #0600FF;">Dim</span> objArray <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Object</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
num <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
num2 <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
goto Label_0077
Label_0006:
num <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>num <span style="color: #008000;">+</span> <span style="color: #0600FF;">CInt</span><span style="color: #000000;">&#40;</span>Math.<span style="color: #0000FF;">Floor</span><span style="color: #000000;">&#40;</span>Math.<span style="color: #0600FF;">Sqrt</span> _
<span style="color: #000000;">&#40;</span>Math.<span style="color: #0600FF;">Abs</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>Math.<span style="color: #0000FF;">Pow</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">CDbl</span><span style="color: #000000;">&#40;</span>nom.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">&#40;</span>num2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #FF0000;">3</span><span style="color: #000000;">&#41;</span> _
<span style="color: #804040;">Mod</span> <span style="color: #FF0000;">2147483648</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">String</span>.<span style="color: #0000FF;">Concat</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">New</span> <span style="color: #FF0000;">Object</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> _
<span style="color: #000000;">&#123;</span> <span style="color: #808080;">&quot;lettre : &quot;</span>, DirectCast<span style="color: #000000;">&#40;</span>nom.<span style="color: #0000FF;">Chars</span><span style="color: #000000;">&#40;</span>num2<span style="color: #000000;">&#41;</span>, Char<span style="color: #000000;">&#41;</span>, _
<span style="color: #808080;">&quot;code : &quot;</span>, <span style="color: #0600FF;">CInt</span><span style="color: #000000;">&#40;</span>num<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
num2 <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>num2 <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span>
Label_0077:
<span style="color: #008080; font-style: italic;">'Here we go:</span>
<span style="color: #0600FF;">If</span> <span style="color: #000000;">&#40;</span>num2 <span style="color: #008000;">&amp;</span>lt; <span style="color: #000000;">&#40;</span>nom.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
goto Label_0006
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
num <span style="color: #008000;">=</span> <span style="color: #0600FF;">CInt</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">CLng</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>num <span style="color: #008000;">*</span> num<span style="color: #000000;">&#41;</span> <span style="color: #008000;">*</span> num<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #804040;">Mod</span> <span style="color: #008000;">&amp;</span>amp;H80000000<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;code : &quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">CInt</span><span style="color: #000000;">&#40;</span>num<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
num <span style="color: #008000;">=</span> Math.<span style="color: #0600FF;">Abs</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>num <span style="color: #008000;">-</span> <span style="color: #000000;">&#40;</span>num <span style="color: #804040;">Mod</span> <span style="color: #008000;">&amp;</span>amp;H89B<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;code : &quot;</span> <span style="color: #008000;">&amp;</span>amp; <span style="color: #0600FF;">CInt</span><span style="color: #000000;">&#40;</span>num<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #FF8000;">Return</span> numEnd <span style="color: #0600FF;">Function</span></pre></div></div>

<p style="text-align: justify;">See nothing? Yeah, there&#8217;s a small bug: the key is initialized to zero, while the loop is done (n-1) times (n is the number of character in the given user name string). So with a little logic, if the name I enter is only one char, it will not loop and the serial number will be zero as initialized previously.  The objective here was not to crack it of course, I contacted the programmer and I suppose he corrected the bug, all here is about what people can do with YOUR code!</p>
<p style="text-align: justify;">To finish this long post, I&#8217;ll just say a fact: in my computer, the folder \Office12 is having more than 200 PE files (most are Microsoft written), but curiously none of these files have been compiled with the ‘.Net super technology&#8217; and I (still) wonder why!</p>


<p>Related posts:<ol><li><a href='http://www.chlankboot.com/blog/archives/690/chlankmail-extract-mail-addresses-from-text' rel='bookmark' title='Permanent Link: ChlankMail: Extract Email Addresses From Any Text'>ChlankMail: Extract Email Addresses From Any Text</a></li>
<li><a href='http://www.chlankboot.com/blog/archives/1030/a-convenient-way-to-fill-in-word-custom-properties' rel='bookmark' title='Permanent Link: A Convenient Way to Fill-In Word Custom Properties'>A Convenient Way to Fill-In Word Custom Properties</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.chlankboot.com/blog/archives/23/me-net-and-the-others/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
