<?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>DaVinci Unlimited Software &#187; code</title>
	<atom:link href="http://www.davinciunltd.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davinciunltd.com</link>
	<description>Jim McKeeth's blog on creative and innovative Delphi programming.</description>
	<lastBuildDate>Tue, 06 Jul 2010 20:18:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Order of Enum in Case Statement</title>
		<link>http://www.davinciunltd.com/2008/07/order-of-enum-in-case-statement/</link>
		<comments>http://www.davinciunltd.com/2008/07/order-of-enum-in-case-statement/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 00:16:58 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Assembly]]></category>
		<category><![CDATA[disassembly]]></category>
		<category><![CDATA[Enumerations]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Win32]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2008/07/order-of-enum-in-case-statement/</guid>
		<description><![CDATA[A while back my manager asked me if the order of the enums in a Delphi case statement changed performance: i.e. Enums in order being faster then those not.&#160; I was pretty sure it didn&#8217;t, but thought it was worth checking out.&#160; Time for a test application and some disassembly . . . 

Here are [...]]]></description>
			<content:encoded><![CDATA[<p>A while back my manager asked me if the order of the enums in a Delphi case statement changed performance: i.e. Enums in order being faster then those not.&#160; I was pretty sure it didn&#8217;t, but thought it was worth checking out.&#160; Time for a test application and some disassembly . . . </p>
<p><span id="more-72"></span></p>
<p>Here are my types and variables, which are the same for both examples.</p>
<pre><code><strong>type</strong></code>
  TMyEnum = (my1, my2, my3, my4);</pre>
<pre><code class="keyword"><strong>var</strong></code>
  myEnum: TMyEnum;
  val: Char;</pre>
<p>Here are the two examples, side by side, with assembly code to follow.&#160; BTW, compiler optimization was turned <em>on</em>.</p>
<table cellspacing="0" cellpadding="2" width="400" border="0">
<tbody>
<tr>
<th width="49%" colspan="2">Case enum <em>in</em> order</th>
<th width="49%" colspan="2">Case enum <em>out of</em> order</th>
</tr>
<tr>
<td colspan="2">
<pre><code></code>  myEnum := my1;
  <code><strong>case</strong></code> myEnum <code><strong>of</strong></code>
    my1: val := <code class="quote">'1'</code>;
    my2: val := <code class="quote">'2'</code>;
    my3: val := <code class="quote">'3'</code>;
    my4: val := <code class="quote">'4'</code>;
  <code><strong>else</strong></code>
    val := <code class="quote">'?'</code>;
  <code><strong>end</strong></code>;</pre>
</td>
<td colspan="2">
<pre><code></code>  myEnum := my1;
  <code><strong>case</strong></code> myEnum <code><strong>of</strong></code>
    my3: val := <code class="quote">'3'</code>;
    my1: val := <code class="quote">'1'</code>;
    my4: val := <code class="quote">'4'</code>;
    my2: val := <code class="quote">'2'</code>;
  <code><strong>else</strong></code>
    val := <code class="quote">'?'</code>;
  <code><strong>end</strong></code>;</pre>
</td>
</tr>
<tr>
<th colspan="4"><em>&#8212;&#8211; Disassembly &#8212;&#8211;</em></th>
</tr>
<tr>
<td colspan="2"><em>case myEnum of</em></td>
<td colspan="2"><em>case myEnum of</em></td>
</tr>
<tr>
<td width="25%">BF9E</td>
<td width="24%">sub al,$01</td>
<td width="24%">C00A</td>
<td width="25%">sub al,$01</td>
</tr>
<tr>
<td>BFA0</td>
<td>jb $bfae</td>
<td>C00C</td>
<td>jb $c01e</td>
</tr>
<tr>
<td>BFA2</td>
<td>jz $bfb2</td>
<td>C00E</td>
<td>jz $c026</td>
</tr>
<tr>
<td>BFA4</td>
<td>dec al</td>
<td>C010</td>
<td>dec al</td>
</tr>
<tr>
<td>BFA6</td>
<td>jz $bfb6</td>
<td>C012</td>
<td>jz $c01a</td>
</tr>
<tr>
<td>BFA8</td>
<td>dec al</td>
<td>C014</td>
<td>dec al</td>
</tr>
<tr>
<td>BFAA</td>
<td>jz $bfba</td>
<td>C016</td>
<td>jz $c022</td>
</tr>
<tr>
<td>BFAC</td>
<td>jmp $bfbe</td>
<td>C018</td>
<td>jmp $c02a</td>
</tr>
<tr>
<td colspan="2"><em>my1: val := &#8216;1&#8242;;</em></td>
<td colspan="2"><em>my3: val := &#8216;3&#8242;;</em></td>
</tr>
<tr>
<td>BFAE</td>
<td>mov bl,$31</td>
<td>C01A</td>
<td>mov bl,$33</td>
</tr>
<tr>
<td>BFB0</td>
<td>jmp $bfc0</td>
<td>C01C</td>
<td>jmp $c02c</td>
</tr>
<tr>
<td colspan="2"><em>my2: val := &#8216;2&#8242;;</em></td>
<td colspan="2"><em>my1: val := &#8216;1&#8242;;</em></td>
</tr>
<tr>
<td>BFB2</td>
<td>mov bl,$32</td>
<td>C01E</td>
<td>mov bl,$31</td>
</tr>
<tr>
<td>BFB4</td>
<td>jmp $bfc0</td>
<td>C020</td>
<td>jmp $c02c</td>
</tr>
<tr>
<td colspan="2"><em>my3: val := &#8216;3&#8242;;</em></td>
<td colspan="2"><em>my4: val := &#8216;4&#8242;;</em></td>
</tr>
<tr>
<td>BFB6</td>
<td>mov bl,$33</td>
<td>C022</td>
<td>mov bl,$34</td>
</tr>
<tr>
<td>BFB8</td>
<td>jmp $bfc0</td>
<td>C024</td>
<td>jmp $c02c</td>
</tr>
<tr>
<td colspan="2"><em>my4: val := &#8216;4&#8242;;</em></td>
<td colspan="2"><em>my2: val := &#8216;2&#8242;;</em></td>
</tr>
<tr>
<td>BFBA</td>
<td>mov bl,$34</td>
<td>C026</td>
<td>mov bl,$32</td>
</tr>
<tr>
<td>BFBC</td>
<td>jmp $bfc0</td>
<td>C028</td>
<td>jmp $c02c</td>
</tr>
<tr>
<td colspan="2"><em>val := &#8216;?&#8217;;</em></td>
<td colspan="2"><em>val := &#8216;?&#8217;;</em></td>
</tr>
<tr>
<td>BFBE</td>
<td>mov bl,$20</td>
<td>C02A</td>
<td>mov bl,$20</td>
</tr>
</tbody>
</table>
<p>Same number of lines of assembly code. There may be some internal CPU optimization, but I don&#8217;t expect there is any. </p>
<p><strong>Conclusion: </strong>Order of the enum in the case statement does not change performance.&#160; Anyone else have any details I missed, or evidence to the contrary?&#160; I guess the next step is to test it in .NET and IL. . . . </p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2008/07/order-of-enum-in-case-statement/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>BITS TLB and Headers</title>
		<link>http://www.davinciunltd.com/2008/03/bits-tlb-and-headers/</link>
		<comments>http://www.davinciunltd.com/2008/03/bits-tlb-and-headers/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 07:43:42 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[BITS]]></category>
		<category><![CDATA[Delphi programming]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[Service]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2008/03/bits-tlb-and-headers/</guid>
		<description><![CDATA[If you want to program with Microsoft&#8217;s Background Intelligent Transfer Service (BITS) then you will need the TLB or header files. These can be generated from the IDL files that come with the Windows XP SP2 Platform SDK, or any of the subsequent platform SDKs, the latest being Windows SDK for Windows Server 2008 and [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to program with Microsoft&#8217;s Background Intelligent Transfer Service (BITS) then you will need the TLB or header files. These can be generated from the IDL files that come with the Windows XP SP2 Platform SDK, or any of the subsequent platform SDKs, the latest being Windows SDK for Windows Server 2008 and .NET Framework 3.5. You will need MIDL to generate the needed files. It is rather a pain to download that whole SDK and then generate the useful files.To make your life easier I have generated the useful files, and also ran them through Delphi RAD Studio 2007 for Win32 to create Object Pascal wrappers for your Delphi programming pleasure. Then I wrapped it all up in a zip for easy downloading. Much quicker to download.</p>
<p>As a note, you do not need to deploy any of these files, or the files in the SDK with your application. You just need to ensure that the Background Transfer Service is running on the target machine.</p>
<p>For more information, I have created a hub page on <a href="http://www.davinciunltd.com/code/advanced-downloads-with-delphi/">Advanced Downloads with Delphi</a> that I will update with more information as I gather it.</p>
<p>Enjoy!</p>
<p>[<a href="http://www.davinciunltd.com/download/bits-tbl,c,header,pas(3.0).zip">Download C, TBL, H, PAS archive</a>]</p>
<p><font size="1">Technorati Tags: </font><a href="http://technorati.com/tags/BITS" rel="tag"><font size="1">BITS</font></a><font size="1">, </font><a href="http://technorati.com/tags/Downloads" rel="tag"><font size="1">Downloads</font></a><font size="1">, </font><a href="http://technorati.com/tags/Service" rel="tag"><font size="1">Service</font></a><font size="1">, </font><a href="http://technorati.com/tags/SDK" rel="tag"><font size="1">SDK</font></a><font size="1">, </font><a href="http://technorati.com/tags/Library" rel="tag"><font size="1">Library</font></a><font size="1">, </font><a href="http://technorati.com/tags/Delphi%20programming" rel="tag"><font size="1">Delphi programming</font></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2008/03/bits-tlb-and-headers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Advanced Downloads Page</title>
		<link>http://www.davinciunltd.com/2008/01/advanced-downloads-page/</link>
		<comments>http://www.davinciunltd.com/2008/01/advanced-downloads-page/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 20:06:21 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Seattle]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[free stuff]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[CodeCamp Demo Libraries FTP HTTP BITS Downloads Delphi]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2008/01/advanced-downloads-page/</guid>
		<description><![CDATA[I&#8217;ve compiled all my Advanced Downloads links into a single page to make it easy to find for anyone who was in the Seattle Code Camp session on Advanced Downloads.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve compiled all my <a href="http://www.davinciunltd.com/code/advanced-downloads-with-delphi/">Advanced Downloads</a> links into a single page to make it easy to find for anyone who was in the Seattle Code Camp session on Advanced Downloads.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2008/01/advanced-downloads-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get Current Process Memory</title>
		<link>http://www.davinciunltd.com/2007/12/current-process-memory/</link>
		<comments>http://www.davinciunltd.com/2007/12/current-process-memory/#comments</comments>
		<pubDate>Thu, 27 Dec 2007 21:41:58 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2007/12/currentprocessmemory/</guid>
		<description><![CDATA[Want to know how much memory your program is using?  This Delphi function will do the trick. 
uses psAPI;
{...}
function CurrentProcessMemory: Cardinal;
var
  MemCounters: TProcessMemoryCounters;
begin
  MemCounters.cb := SizeOf(MemCounters);
  if GetProcessMemoryInfo(GetCurrentProcess,
      @MemCounters,
      SizeOf(MemCounters)) then
    Result := MemCounters.WorkingSetSize
  else
   [...]]]></description>
			<content:encoded><![CDATA[<p>Want to know how much memory your program is using?  This Delphi function will do the trick. </p>
<pre lang="Delphi">uses psAPI;
{...}
function CurrentProcessMemory: Cardinal;
var
  MemCounters: TProcessMemoryCounters;
begin
  MemCounters.cb := SizeOf(MemCounters);
  if GetProcessMemoryInfo(GetCurrentProcess,
      @MemCounters,
      SizeOf(MemCounters)) then
    Result := MemCounters.WorkingSetSize
  else
    RaiseLastOSError;
end;</pre>
<blockquote><p><strong>Update: </strong>Thanks to Andreas for a heap free (no GetMem / FreeMem) method of doing this (via his comment!)</p></blockquote>
<p>Not sure where I got the basics of this, but I added some better error handling to it and made it a function.  WorkingSetSize is the amount of memory currently used.  You can use similar code to get other values for the current process (or any process).  You will need to include <strong>psAPI</strong> in your uses statement.</p>
<p>The <code>PROCESS_MEMORY_COUNTERS</code> record includes:</p>
<ul>
<li>PageFaultCount</li>
<li>PeakWorkingSetSize</li>
<li>WorkingSetSize</li>
<li>QuotaPeakPagedPoolUsage</li>
<li>QuotaPagedPoolUsage</li>
<li>QuotaPeakNonPagedPoolUsage</li>
<li>QuotaNonPagedPoolUsage</li>
<li>PagefileUsage</li>
<li>PeakPagefileUsage</li>
</ul>
<p>You can find all of these values in Task Manager or Process Explorer.  </p>
<p>Maybe this would be a good task for one of Delphi&#8217;s new records that include methods. . . .</p>
<p>It would appear</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2007/12/current-process-memory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>List of 3rd Party Components for Delphi 2007</title>
		<link>http://www.davinciunltd.com/2007/12/list-of-3rd-party-components-for-delphi-2007/</link>
		<comments>http://www.davinciunltd.com/2007/12/list-of-3rd-party-components-for-delphi-2007/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 20:00:27 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[turbopower]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2007/12/list-of-3rd-party-components-for-delphi-2007/</guid>
		<description><![CDATA[My thanks to Andreano Lanusse, the Product Line Manager for Latin America at CodeGear, who just posted a list of 3rd Party Components for Delphi 2007.  This is a great resource.  Andreano is open to suggestions and feedback on his list too and has provided his email address for everyone.  
This has [...]]]></description>
			<content:encoded><![CDATA[<p>My thanks to Andreano Lanusse, the Product Line Manager for Latin America at CodeGear, who just posted a <a href="http://dn.codegear.com/article/37455">list of 3rd Party Components for Delphi 2007</a>.  This is a great resource.  Andreano is open to suggestions and feedback on his list too and has provided his email address for everyone.  </p>
<p>This has long been one of the strengths of Delphi &#8211; the strong collection of 3rd party components.  3rd party component development was of course fostered by the fact that Delphi came with full source for the VCL and RTL.  A move the Microsoft if finally duplicating in releasing the source for the .NET framework.  Although unlike Delphi, Microsoft will <em><strong>not</strong></em> allow you to modify and recompile the framework in your applications.  With Delphi you can tweak the VCL and recompile it (not a trivial task, but allowable and possible) for your applications.  Granted doing so makes moving to new versions of Delphi a little more tricky, and you cannot redistribute the modified source.</p>
<p><em>BTW, notice the link to my <a href="http://www.bsdg.org/resources/turbopower.html">TurboPower page</a> on line 27.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2007/12/list-of-3rd-party-components-for-delphi-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeRage II is a Success</title>
		<link>http://www.davinciunltd.com/2007/11/coderage-ii-is-a-success/</link>
		<comments>http://www.davinciunltd.com/2007/11/coderage-ii-is-a-success/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 21:45:56 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[CodeRage]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[free stuff]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2007/11/coderage-ii-is-a-success/</guid>
		<description><![CDATA[Wow, what a week.  CodeRage II went great.  A lot of good content and I enjoyed presenting my sessions.  You can get the code, links, etc. from them here:

Exceptional Exceptions
Implementing Cryptography
Class Helpers: Friend or Foe
Delphi Robot Rage

They all went really well I thought.  Unfortunately I pushed the deadline back too far [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, what a week.  CodeRage II went great.  A lot of good content and I enjoyed presenting my sessions.  You can get the code, links, etc. from them here:</p>
<ul>
<li><a href="http://www.davinciunltd.com/code/exceptions/">Exceptional Exceptions</a></li>
<li><a href="http://www.davinciunltd.com/code/delphi-cryptography/">Implementing Cryptography</a></li>
<li><a href="http://www.davinciunltd.com/code/delphi-class-helpers/">Class Helpers: Friend or Foe</a></li>
<li><a href="http://www.davinciunltd.com/code/delphi-robot-rage/">Delphi Robot Rage</a></li>
</ul>
<p>They all went really well I thought.  Unfortunately I pushed the deadline back too far on Delphi Robot Rage and my JIT Presentation didn&#8217;t happen on time.  Sorry to everyone about that.  </p>
<p>Check back often for updates (seriously), or let me know if I missed something you are looking for from my sessions.</p>
<p>Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2007/11/coderage-ii-is-a-success/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Crashing Like VB</title>
		<link>http://www.davinciunltd.com/2007/11/crashing-like-vb/</link>
		<comments>http://www.davinciunltd.com/2007/11/crashing-like-vb/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 10:27:20 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[CodeRage]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[exceptions]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[vista]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2007/11/crashing-like-vb/</guid>
		<description><![CDATA[I always thought Delphi&#8217;s global exception handler was a great feature.  It allows your program to continue after an otherwise unhandled exception would have caused it to terminate.  Typically in a serious application you would assign your own global exception handler, or used one of the great 3rd part exception handlers like madExcept [...]]]></description>
			<content:encoded><![CDATA[<p>I always thought Delphi&#8217;s global exception handler was a great feature.  It allows your program to continue after an otherwise unhandled exception would have caused it to terminate.  Typically in a serious application you would assign your own global exception handler, or used one of the great 3rd part exception handlers like <a href="http://www.madshi.net/madExceptDescription.htm">madExcept</a> or <a href="http://www.dimusware.com/products/excmagic/index.html">Exceptional Magic</a> (I love that name!)  They both provide a nice dialog, stack trace, logging and reporting.</p>
<p>Well it turns out that if you want to be <a href="http://download.microsoft.com/download/8/e/4/8e4c929d-679a-4238-8c21-2dcc8ed1f35c/Windows%20Vista%20Software%20Logo%20Spec%201.1.doc" title="Windows Vista Software Logo Spec 1.1.doc">Microsoft Windows Vista Logo certified</a>, then you need to crash your application on certain exceptions.</p>
<blockquote><p>Applications must handle only exceptions that are known and expected, and Windows Error Reporting must not be disabled.  If a fault (such as an Access Violation) is injected into an application, the application must allow Windows Error Reporting to report this crash.  (from requirement <em>3.2  Resilient Software: Eliminate Application Failures</em>)</p></blockquote>
<p>Microsoft&#8217;s rational for this requirement is the ISV will receive the error report Microsoft collects for them. I guess most software developers don&#8217;t have access to tools like we do in Delphi to catch exceptions and log them for us.</p>
<p>So short of tossing out the Forms unit and writing everything from scratch, how can you get around the usefulness of the global exception handler.</p>
<p>My first thought was to create a custome application exception handler by placing a TApplicationEvents on your main form and assigning the OnException event.  In the event include the line</p>
<pre lang="Delphi">  raise e;</pre>
<p>This will pass an exception up to the operating system and terminate your application, at least when I tested it in Delphi 2007.  When I tried it in Delphi 7, it didn&#8217;t work right.</p>
<p>A more elegant and involved solution:</p>
<p>First you need a couple global variables:</p>
<pre lang="delphi">var
  GlobalExcept: Exception;
  GlobalExceptAddr: Pointer;</pre>
<p>And a global exception handler:</p>
<pre lang="Delphi">procedure TForm1.ApplicationException(Sender: TObject; E: Exception);
begin
  if E is EAccessViolation then
  begin
    // Keep the exception object from being destroyed!
    AcquireExceptionObject;
    GlobalExcept := e;
    GlobalExceptAddr := ExceptAddr;
    Application.Terminate;
  end;
end;</pre>
<p>The rest of the magic happens in the project file (DPR)</p>
<pre lang="delphi">begin
  GlobalExcept := nil;
  GlobalExceptAddr := nil;
  try
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
  Application.Run;
  finally
    if Assigned( GlobalExcept ) then
    begin
      raise GlobalExcept at GlobalExceptAddr;
    end;
  end;
end.</pre>
<p>And you can [<a href="/download/CrashLikeVB.zip">download the code</a>].</p>
<p><a href="http://groups.google.com/group/borland.public.delphi.non-technical/browse_thread/thread/861ffdef8f23b7be" title="Read the thread on Google Groups.">Thanks to Jeremi Reda for asking this question in borland.public.delphi.non-technical.</a></p>
<p>I didn&#8217;t cover this in my CodeRage II session on Exceptional Exceptions, but there is a lot of other cool stuff, like <code>AcquireExceptionObject</code>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2007/11/crashing-like-vb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>D-Robots and Delphi Robot Rage</title>
		<link>http://www.davinciunltd.com/2007/11/d-robots-and-delphi-robot-rage/</link>
		<comments>http://www.davinciunltd.com/2007/11/d-robots-and-delphi-robot-rage/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 18:57:34 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[CodeRage]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[funny]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2007/11/d-robots-and-delphi-robot-rage/</guid>
		<description><![CDATA[The last session of CodeRage ][ (now FREE!) is the Delphi Robot Rage.  This is your opportunity to show off your amazing Delphi programming skills.  Download D-Robots and build your robot to compete in a Death Match on the Light Plaza map against one or more robots created by other participants.  There [...]]]></description>
			<content:encoded><![CDATA[<p>The last session of <a href="http://conferences.codegear.com/coderage07">CodeRage ][ (now FREE!)</a> is the Delphi Robot Rage.  This is your opportunity to show off your amazing Delphi programming skills.  <a href="http://www.davinciunltd.com/code/delphi-robot-rage/">Download D-Robots</a> and build your robot to compete in a <em>Death Match </em>on the <em>Light Plaza</em> map against one or more robots created by other participants.  There will be amazing prizes (undisclosed as of yet), but of course the best prize will be having your amazing programming skills shown off to the world.</p>
<p><strong>Requirements</strong>:</p>
<ol>
<li>   Robot must have unsecured source  (no password, or password must be provided), although the source will not be revealed until after the challenge is completed.</li>
<li>If a unique skin is not used for your robot, then a new skin may be assigned to your robot for visual identification.</li>
<li>Competition is open to everyone.  No purchase necessary.  Not required to be in attendance at CodeRage II to enter or win, although that is the best way to see the action!</li>
<li> <a href="mailto:delphirobotrage@mckeeth.org">Email your robot to me</a> (<a href="mailto:delphirobotrage@davinciunltd.com">delphirobotrage@davinciunltd.com</a>), and I will reply with acknowledgment.  If I don&#8217;t reply, I didn&#8217;t receive it.</li>
</ol>
<p><strong>Deadline for submissions: </strong>November 26th, 2007 &#8211; midnight Pacific Time</p>
<p><strong>Notice: </strong>There is an incompatibility between D-Robots and some video drivers (maybe just ATI).  No known work around.  It does work in a virtual machine, but your frame rate will be very poor.</p>
<p>If you submit your robot early enough, you might get some feedback from a practice round.</p>
<p align="center"><a href="http://www.davinciunltd.com/code/delphi-robot-rage/"><strong>Short intro video online &amp; Partial list of prizes.</strong></a></p>
<p>Questions? Comments?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2007/11/d-robots-and-delphi-robot-rage/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Just Talking to My Self</title>
		<link>http://www.davinciunltd.com/2007/11/just-talking-to-my-self/</link>
		<comments>http://www.davinciunltd.com/2007/11/just-talking-to-my-self/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 23:34:19 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[funny]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2007/11/just-talking-to-my-self/</guid>
		<description><![CDATA[There is something rather trippy about debugging a server that opens a socket and talks to itself.  Have to pay really close attention or Delphi will trace back into the server again, and all of a sudden you are someplace entirely different in the application.  Of course if you have a break point that gets [...]]]></description>
			<content:encoded><![CDATA[<p>There is something rather trippy about debugging a server that opens a socket and talks to itself.  Have to pay really close attention or Delphi will trace back into the server again, and all of a sudden you are someplace entirely different in the application.  Of course if you have a break point that gets triggered by the connection you had better disable it before you connect again.</p>
<p>Now to figure out if the server can get the information it needs from itself without going through a socket connection to itself.  I can see that being a bad scenario if it keeps opening new sockets back to itself again. . . .</p>
<p>Almost as much  fun as leaving comments and ping backs on your own blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2007/11/just-talking-to-my-self/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Missing Delphi BITS Demo!</title>
		<link>http://www.davinciunltd.com/2007/11/the-missing-delphi-bits-demo/</link>
		<comments>http://www.davinciunltd.com/2007/11/the-missing-delphi-bits-demo/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 16:41:16 +0000</pubDate>
		<dc:creator>Jim McKeeth</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.davinciunltd.com/2007/11/the-missing-delphi-bits-demo/</guid>
		<description><![CDATA[Back when I did my first CodeRage presentation I lost my BITS demo I made due to a computer failure.  Well, I recreated it for my PNWDUG presentation last night.  Here it is!  Currently it will only work with the original TLB import (included), but you can modify it easily I am [...]]]></description>
			<content:encoded><![CDATA[<p>Back when I did my first CodeRage presentation I lost my BITS demo I made due to a computer failure.  Well, I recreated it for my <a href="http://www.pnwdelphi.org/">PNWDUG</a> <a href="http://www.davinciunltd.com/2007/10/advanced-file-transfers-with-http-and-ftp/">presentation last night</a>.  Here it is!  Currently it will only work with the original TLB import (included), but you can modify it easily I am sure.  See the <a href="http://www.davinciunltd.com/2007/03/programming-with-bits-in-delphi/">original post</a> for more information. Enjoy!</p>
<p>[<a href="http://www.davinciunltd.com/download/DelphiBits1.5tlb.zip">Download</a>] [<a href="http://www.davinciunltd.com/2007/03/programming-with-bits-in-delphi/">Original post</a>] [<a href="http://www.davinciunltd.com/viewcode/BitsDemo.html">View Code</a>]</p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.davinciunltd.com/2007/11/the-missing-delphi-bits-demo/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
