<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Marius Žemaitis's Weblog</title>
	<atom:link href="http://mzemaitis.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mzemaitis.wordpress.com</link>
	<description>ideas for better life</description>
	<lastBuildDate>Tue, 22 Sep 2009 07:34:15 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='mzemaitis.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/8825112bfa340760bc6369aa7b455a2b?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Marius Žemaitis's Weblog</title>
		<link>http://mzemaitis.wordpress.com</link>
	</image>
			<item>
		<title>Be careful with FormCloseQuery</title>
		<link>http://mzemaitis.wordpress.com/2009/09/07/be-careful-with-formclosequery/</link>
		<comments>http://mzemaitis.wordpress.com/2009/09/07/be-careful-with-formclosequery/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 19:52:52 +0000</pubDate>
		<dc:creator>mzemaitis</dc:creator>
				<category><![CDATA[Delphi tips]]></category>
		<category><![CDATA[FormCloseQuery WM_QueryEndSession]]></category>

		<guid isPermaLink="false">http://mzemaitis.wordpress.com/?p=78</guid>
		<description><![CDATA[ Recently I had a very hard to find bug-problem with closing my application (made in Delphi).    It just refused to respond to Windows shutdown messages and prevented Windows to shutdown and restart.. 
I spent a lot of hours investigating this problem.   Initially the first part of the problem, because [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=78&subd=mzemaitis&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mzemaitis.files.wordpress.com/2009/09/help64.png"><img style="border-bottom:0;border-left:0;display:inline;margin-left:0;border-top:0;margin-right:0;border-right:0;" title="help 64" border="0" alt="help 64" align="left" src="http://mzemaitis.files.wordpress.com/2009/09/help64_thumb.png?w=68&#038;h=68" width="68" height="68" /></a> Recently I had a very hard to find bug-problem with closing my application (made in Delphi).    <br />It just refused to respond to Windows shutdown messages and prevented Windows to shutdown and restart.. </p>
<p align="justify">I spent a lot of hours investigating this problem.   <br />Initially the <strong>first part</strong> of the problem, because I was showing a dialog&#160; for &quot;Really close?&quot; and preventing closing if some files are not saved, this was done in FormCloseQuery and it was stupid approach, because FormCloseQuery doesn&#8217;t know if windows is shutting down and thus preventing shutdown.</p>
<p align="justify">Than, I made a Message listeners for windows asking applications query for shutdown : <a href="http://msdn.microsoft.com/en-us/library/aa376890(VS.85).aspx" target="_blank"><strong>WM_QueryEndSession</strong></a> and <strong>WM_EndSession</strong>.    <br />The problem remained: the messages were received only <strong>second time</strong>. The first time when Windows was shutting down the application was still preventing shutdown, and only for the second Shutdown call, the messages were received and Application quit.    <br />So something else was corrupting even the messages <span>queue. </span></p>
<p align="justify"><span>After some time, I accidentally came under another Form in same application, which also had <strong>FormCloseQuery</strong>, this time it was really needed because this Form was closing with fading effect and Query was preventing close until fader finished. So that was the <strong>second part </strong>of the problem.      <br />Again I needed to listen for Shutdown messages in this Form. </span></p>
<p align="justify"><span><strong>So to conclude</strong>: you need to listen for Windows shut down Messages and Queries in every form that has FormCloseQuery or better yet <strong>avoid it</strong>, if you want to let windows shutdown normally. Also to note: Delphi made apps, on Windows shutdown exit instantly</span><span> without freeing objects, so be careful and it is a good practice to listen to Shutdown procedure and to call your own <strong>Closing</strong> procedure manually. </span></p>
<p><span>More code examples on this soon..</span></p>
<p><span>&#160;</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mzemaitis.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mzemaitis.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mzemaitis.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mzemaitis.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mzemaitis.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mzemaitis.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mzemaitis.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mzemaitis.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mzemaitis.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mzemaitis.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=78&subd=mzemaitis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mzemaitis.wordpress.com/2009/09/07/be-careful-with-formclosequery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a31ca29806040496185881ddc47fb76?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">mzemaitis</media:title>
		</media:content>

		<media:content url="http://mzemaitis.files.wordpress.com/2009/09/help64_thumb.png" medium="image">
			<media:title type="html">help 64</media:title>
		</media:content>
	</item>
		<item>
		<title>Saving and Loading strings in stream the Delphi 2009 way</title>
		<link>http://mzemaitis.wordpress.com/2009/03/27/saving-and-loading-strings-in-stream-the-delphi-2009-way/</link>
		<comments>http://mzemaitis.wordpress.com/2009/03/27/saving-and-loading-strings-in-stream-the-delphi-2009-way/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 14:17:31 +0000</pubDate>
		<dc:creator>mzemaitis</dc:creator>
				<category><![CDATA[Delphi tips]]></category>
		<category><![CDATA[Delphi 2009]]></category>
		<category><![CDATA[Strings Write Read Stream]]></category>

		<guid isPermaLink="false">http://mzemaitis.wordpress.com/?p=42</guid>
		<description><![CDATA[ Lately, I had a simple task to save and load some short strings in file.     The quickest and fastest way is to do it with streams (TFileStream or TMemoryStream).
Because in Delphi 2009 string type strings are Unicode so they are also double byte sized than in previous Delphi strings.  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=42&subd=mzemaitis&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mzemaitis.files.wordpress.com/2009/06/refresh.png"><img style="display:inline;border-width:0;margin:0 4px 4px 0;" title="Refresh" border="0" alt="Refresh" align="left" src="http://mzemaitis.files.wordpress.com/2009/06/refresh_thumb.png?w=128&#038;h=128" width="128" height="128" /></a> Lately, I had a simple task to save and load some short strings in file.     <br />The quickest and fastest way is to do it with streams (TFileStream or TMemoryStream).</p>
<p>Because in Delphi 2009 <strong>string</strong> type strings are Unicode so they are also double byte sized than in previous Delphi strings.     <br />So you need to be very strict to write exact BYTES of the string, not characters, because character size is now 2 Bytes!</p>
<p>For Writing <strong>String </strong>to any stream use this Function :</p>
<p>The reading of string shoud be also exact with character size in mind. Because you can read only half of string:</p>
<p> <span style="color:#0000ff;"><font color="#000080">
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">function ReadStreamInt(Stream : TStream) : integer; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">begin </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   Stream.ReadBuffer(Result, SizeOf(Integer)); </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">end; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">function ReadStreamStr(Stream : TStream) : <span style="color:#0000ff;">string</span>; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">  var </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   StrLen : integer; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   TempStr : <span style="color:#0000ff;">string</span>; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">begin </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   TempStr := <span style="color:#006080;">''</span>; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   StrLen := ReadStreamInt(Stream); </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   <span style="color:#0000ff;">if</span> StrLen &gt; -1 then </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      begin </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        SetLength(TempStr, StrLen); </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#008000;">//Here you should also check the character size </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#008000;">//Reading Bytes! </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        Stream.ReadBuffer(Pointer(TempStr)^, StrLen * SizeOf(Char)); </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        result := TempStr; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">     end </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">     <span style="color:#0000ff;">else</span> Result := <span style="color:#006080;">''</span>; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">end;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<p><!--CRLF--></div>
</p></div>
<p>    <span style="color:#0000ff;"></span></font></span></p>
<p>Then you can write functions for writing and loading strings for example:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">function SaveToDFile( FileName: String; sDescr : <span style="color:#0000ff;">string</span>; ) : boolean;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   var  MemStr: TMemoryStream;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">begin</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    MemStr:= TMemoryStream.Create;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">try</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">     <span style="color:#0000ff;">try</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      WriteStreamStr( MemStr, sDescr );</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      MemStr.SaveToFile(FileName);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      result := True;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">     except</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        on E:EWriteError <span style="color:#0000ff;">do</span> result := False;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">     end;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   <span style="color:#0000ff;">finally</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      MemStr.Free;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   end;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">end;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">function LoadFromDFile( FileName: String; var sDescr : <span style="color:#0000ff;">string</span>; ) : boolean;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   var MemStr: TMemoryStream;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">begin</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   MemStr:= TMemoryStream.Create;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">   <span style="color:#0000ff;">try</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">try</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      MemStr.LoadFromFile(FileName);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      sDescr := ReadStreamStr( MemStr );</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      result := True;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">     except</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">       on E:EReadError <span style="color:#0000ff;">do</span> result := False;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">     end;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">finally</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">     MemStr.Free;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    end;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">end;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<p><!--CRLF--></div>
</div>
<p>Hope it helps some.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mzemaitis.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mzemaitis.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mzemaitis.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mzemaitis.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mzemaitis.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mzemaitis.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mzemaitis.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mzemaitis.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mzemaitis.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mzemaitis.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=42&subd=mzemaitis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mzemaitis.wordpress.com/2009/03/27/saving-and-loading-strings-in-stream-the-delphi-2009-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a31ca29806040496185881ddc47fb76?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">mzemaitis</media:title>
		</media:content>

		<media:content url="http://mzemaitis.files.wordpress.com/2009/06/refresh_thumb.png" medium="image">
			<media:title type="html">Refresh</media:title>
		</media:content>
	</item>
		<item>
		<title>How to install Microsoft TTS Anna engine on Windows XP</title>
		<link>http://mzemaitis.wordpress.com/2009/02/19/how-to-install-microsoft-tts-anna-engine-on-windows-xp/</link>
		<comments>http://mzemaitis.wordpress.com/2009/02/19/how-to-install-microsoft-tts-anna-engine-on-windows-xp/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 09:02:27 +0000</pubDate>
		<dc:creator>mzemaitis</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Anna]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[TTS]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://mzemaitis.wordpress.com/?p=28</guid>
		<description><![CDATA[&#160; Microsoft introduced new TTS voice called &#34;Anna&#34; on Vista OS. Sadly it is only available for Vista and no separate download option for Windows XP users, personally I still use Windows XP on many machines.  
You can find more info about TTS (Text To Speech engines on Microsoft site). New voice &#34;Anna&#34; is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=28&subd=mzemaitis&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mzemaitis.files.wordpress.com/2009/06/bookopensound1281.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 4px 4px;" title="book open sound 128" border="0" alt="book open sound 128" align="left" src="http://mzemaitis.files.wordpress.com/2009/06/bookopensound128_thumb1.png?w=128&#038;h=128" width="128" height="128" /></a>&#160; Microsoft introduced new TTS voice called &quot;Anna&quot; on Vista OS. Sadly it is only available for Vista and no separate download option for Windows XP users, personally I still use Windows XP on many machines. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>You can find more info about TTS (Text To Speech engines on <a href="http://www.microsoft.com/speech/speech2007/default.mspx">Microsoft site</a>). New voice &quot;Anna&quot; is more clear and more natural, than any other voice available on XP versi0ns.</p>
<p>Still, there is an option to use &quot;Anna&quot; voice on XP for FREE. You need to download and install <a href="http://www.microsoft.com/Streets/en-us/default.aspx">Microsoft Street And Trips 2009</a> !    <br />It is available for FREE (60 day trial version is download-able from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=56ccd694-4df8-4602-abfc-aea24c1dbf45&amp;DisplayLang=en">Microsoft here</a> ). Its huge, about 1,5 GB, so you need some place on your hard disk for download.</p>
<p>So download and install Streets 2009. With it also Microsoft nice &quot;Anna&quot; TTS engine is installed to pronounce (speak) street names.   <br />You can enjoy this product for 60 days, or uninstall it the same day &#8212; &quot;Anna&quot; engine will not be uninstalled ! Cool. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />     <br />It is still left on system.    <br />You can check its properties through Control Panel&#8217;s Speech category settings.</p>
<p>Enjoy!</p>
<p>PS. It is also possible to extract only TTS Anna setup files (About 32 MB). But still you should download Streets at first. Then after installation start, look for temp folder where temporary installation files were extracted. Most probably it will be your User&#8217;s &quot;Documents and Settings/Local settings/Temp&quot; Folder. Look for TTS.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mzemaitis.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mzemaitis.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mzemaitis.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mzemaitis.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mzemaitis.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mzemaitis.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mzemaitis.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mzemaitis.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mzemaitis.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mzemaitis.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=28&subd=mzemaitis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mzemaitis.wordpress.com/2009/02/19/how-to-install-microsoft-tts-anna-engine-on-windows-xp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a31ca29806040496185881ddc47fb76?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">mzemaitis</media:title>
		</media:content>

		<media:content url="http://mzemaitis.files.wordpress.com/2009/06/bookopensound128_thumb1.png" medium="image">
			<media:title type="html">book open sound 128</media:title>
		</media:content>
	</item>
		<item>
		<title>TCoolTrayIcon component for Delphi 2009</title>
		<link>http://mzemaitis.wordpress.com/2008/11/13/tcooltrayicon-component-for-delphi-2009/</link>
		<comments>http://mzemaitis.wordpress.com/2008/11/13/tcooltrayicon-component-for-delphi-2009/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 07:32:25 +0000</pubDate>
		<dc:creator>mzemaitis</dc:creator>
				<category><![CDATA[Delphi components]]></category>
		<category><![CDATA[TCoolTrayIcon component Delphi 2009]]></category>

		<guid isPermaLink="false">http://mzemaitis.wordpress.com/?p=21</guid>
		<description><![CDATA[ For those who are searching TCoolTrayIcon component written by Troels Jakobsen to support newest Delphi versions.
It&#8217;s a comprehensive component for adding icons to the traybar, allowing you to put a tray icon in your own programs. Can hide, show program button on Taskbar, show hide hint balloons and similar. The original component you can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=21&subd=mzemaitis&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mzemaitis.files.wordpress.com/2009/06/viewquickbar.png"><img style="display:inline;border-width:0;margin:0 4px 4px 0;" title="view quick bar" border="0" alt="view quick bar" align="left" src="http://mzemaitis.files.wordpress.com/2009/06/viewquickbar_thumb.png?w=128&#038;h=128" width="128" height="128" /></a> For those who are searching TCoolTrayIcon component written by <strong>Troels Jakobsen</strong> to support newest Delphi versions.</p>
<p><em>It&#8217;s a comprehensive component for adding icons to the traybar, allowing you to put a tray icon in your own programs. Can hide, show program button on Taskbar, show hide hint balloons and similar. The original component you can find on Troel&#8217;s website here: </em><a title="http://subsimple.com/delphi.asp" href="http://subsimple.com/delphi.asp" target="_blank">http://subsimple.com/delphi.asp</a></p>
<p>&#160;</p>
<p>It&#8217;s freeware, so you can use it freely.</p>
<p>The problem is, it was updated very long ago, and supports Delphi versions until 6, though it should function ok till 2007 version.</p>
<p>As with Delphi 2009, where all string and char become full Unicode, version on Troel&#8217;s website isn&#8217;t compatible with Delphi 2009 anymore.</p>
<p>No problem. <a href="http://www.songbeamer.com/delphi/">Sebastian Zierer</a> already made some changes to support Unicode chars. You can find <strong>TCoolTrayIcon</strong> component for Delphi 2009 on his website : <a title="http://tib.s.songbeamer.eu/downloads/Cooltray.zip" href="http://tib.s.songbeamer.eu/downloads/Cooltray.zip">http://tib.s.songbeamer.eu/downloads/Cooltray.zip</a> or you can download same copy here from my website: <a href="http://ze.markos.googlepages.com/Cooltray_2009_2010.zip">Download TCoolTrayIcon zip package</a> </p>
<p>Update: 2008.11.12 fixes for Delphi 2009   <br /><font color="#ff0000">Update: 2009.09.04 with Delphi 2010 package</font></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mzemaitis.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mzemaitis.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mzemaitis.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mzemaitis.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mzemaitis.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mzemaitis.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mzemaitis.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mzemaitis.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mzemaitis.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mzemaitis.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=21&subd=mzemaitis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mzemaitis.wordpress.com/2008/11/13/tcooltrayicon-component-for-delphi-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a31ca29806040496185881ddc47fb76?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">mzemaitis</media:title>
		</media:content>

		<media:content url="http://mzemaitis.files.wordpress.com/2009/06/viewquickbar_thumb.png" medium="image">
			<media:title type="html">view quick bar</media:title>
		</media:content>
	</item>
		<item>
		<title>Upgrade to Delphi 2009 or Not?</title>
		<link>http://mzemaitis.wordpress.com/2008/11/13/upgrade-to-delphi-2009-or-not/</link>
		<comments>http://mzemaitis.wordpress.com/2008/11/13/upgrade-to-delphi-2009-or-not/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 06:16:50 +0000</pubDate>
		<dc:creator>mzemaitis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mzemaitis.wordpress.com/?p=13</guid>
		<description><![CDATA[For those who consider whether upgrade or buy Delphi 2009 I suggest to read these pages:
Some user opinions:
http://www.codegear.com/products/delphi/win32/quotes/
Some more views:
 http://blogs.codegear.com/ao/2008/09/17/38947
In my personal opinion Delphi 2009 is worth buying, even for Unicode alone. At last.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=13&subd=mzemaitis&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For those who consider whether upgrade or buy Delphi 2009 I suggest to read these pages:</p>
<p>Some user opinions:</p>
<p><a title="http://www.codegear.com/products/delphi/win32/quotes/" href="http://www.codegear.com/products/delphi/win32/quotes/" target="_blank">http://www.codegear.com/products/delphi/win32/quotes/</a></p>
<p>Some more views:</p>
<p><a title="http://blogs.codegear.com/ao/2008/09/17/38947" href="http://blogs.codegear.com/ao/2008/09/17/38947"> http://blogs.codegear.com/ao/2008/09/17/38947</a></p>
<p>In my personal opinion Delphi 2009 is worth buying, even for Unicode alone. At last.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mzemaitis.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mzemaitis.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mzemaitis.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mzemaitis.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mzemaitis.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mzemaitis.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mzemaitis.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mzemaitis.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mzemaitis.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mzemaitis.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=13&subd=mzemaitis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mzemaitis.wordpress.com/2008/11/13/upgrade-to-delphi-2009-or-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a31ca29806040496185881ddc47fb76?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">mzemaitis</media:title>
		</media:content>
	</item>
		<item>
		<title>How to show your own custom popup in TWebBrowser component</title>
		<link>http://mzemaitis.wordpress.com/2008/04/24/how-to-show-your-own-custum-popup-in-twebbrowser-component/</link>
		<comments>http://mzemaitis.wordpress.com/2008/04/24/how-to-show-your-own-custum-popup-in-twebbrowser-component/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 11:39:03 +0000</pubDate>
		<dc:creator>mzemaitis</dc:creator>
				<category><![CDATA[Delphi tips]]></category>
		<category><![CDATA[TWebBrowser custom popup menu rightclick]]></category>

		<guid isPermaLink="false">http://mzemaitis.wordpress.com/?p=6</guid>
		<description><![CDATA[If you want to show your custom popup menu in your TWebBrowser component I really recommend to you to download a EmbeddedWB component by bsalsa productions ( &#60;http://www.bsalsa.com/product.html&#62; ).    It is all the same TWebBowser only more user friendly, with more events and methods, added functionality.    By the way, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=6&subd=mzemaitis&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you want to show your custom popup menu in your TWebBrowser component I really recommend to you to download a EmbeddedWB component by bsalsa productions ( &lt;<a title="http://www.bsalsa.com/product.html" href="http://" target="_blank">http://www.bsalsa.com/product.html</a>&gt; ).    <br />It is all the same TWebBowser only more user friendly, with more events and methods, added functionality.    <br />By the way, it is all free.</p>
<p>With this EmbeddedWB you can easily make your own popup menu, even diffrent pop-ups for different selected items in web browser.</p>
<p>So for example, make a default popup when no selection exists, and one custom popup for selected text.</p>
<p>If you have EmbeddedWB installed and have one on your form, look for <strong>OnShowContextMenu </strong>event.</p>
<p>Then your custom popup can be shown with this example code:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">function TForm.WebShowContextMenu(<span style="color:#0000ff;">const</span> dwID: Cardinal;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">  <span style="color:#0000ff;">const</span> ppt: PPoint; <span style="color:#0000ff;">const</span> pcmdtReserved: IInterface;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">  <span style="color:#0000ff;">const</span> pdispReserved: IDispatch): HRESULT;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">begin</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">  <span style="color:#008000;">//When we want to show our custum menu</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">  <span style="color:#0000ff;">if</span> (dwID = 4) <span style="color:#008000;">//any text selection menu is about to show</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    then begin</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      TextPopup.Popup(ppt.X,ppt.Y);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    end</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">else</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">      <span style="color:#0000ff;">if</span> Assigned(MyPopup) <span style="color:#008000;">//if our popup is created</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">         then begin</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">           MyPopup.Popup(ppt.X, ppt.Y);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">           Result := S_OK; <span style="color:#008000;">//don't show WB popup</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">         end</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">         <span style="color:#0000ff;">else</span> Result := S_FALSE; <span style="color:#008000;">//else show IE Popup</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">end;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<p><!--CRLF--></div>
</div>
<p>IE has several different menus for images, text and so on. You can check what menu is about to show by<br />
  <br />checking dwID:</p>
<p><code><br />
    <br /></code></p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_DEFAULT = 0;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_IMAGE = 1;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_CONTROL = 2;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_TABLE = 3;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_TEXTSELECT = 4;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_ANCHOR = 5;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_UNKNOWN = 6;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_IMGDYNSRC = 7;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_IMGART = 8;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CONTEXT_MENU_DEBUG = 9;</pre>
<p><!--CRLF--></div>
</div>
<p>More info can be found here:</p>
<p><a href="http://msdn2.microsoft.com/en-us/library/aa753264.aspx">http://msdn2.microsoft.com/en-us/library/aa753264.aspx</a></p>
<p><a href="http://www.bsalsa.com/ewb_on_show_context.html">http://www.bsalsa.com/ewb_on_show_context.html</a></p>
<p>Hope, this was helpful.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mzemaitis.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mzemaitis.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mzemaitis.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mzemaitis.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mzemaitis.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mzemaitis.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mzemaitis.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mzemaitis.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mzemaitis.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mzemaitis.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mzemaitis.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mzemaitis.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=6&subd=mzemaitis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mzemaitis.wordpress.com/2008/04/24/how-to-show-your-own-custum-popup-in-twebbrowser-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a31ca29806040496185881ddc47fb76?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">mzemaitis</media:title>
		</media:content>
	</item>
		<item>
		<title>How to uninstall Windows Desktop Search</title>
		<link>http://mzemaitis.wordpress.com/2008/04/16/how-to-uninstall-windows-desktop-search/</link>
		<comments>http://mzemaitis.wordpress.com/2008/04/16/how-to-uninstall-windows-desktop-search/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 07:23:16 +0000</pubDate>
		<dc:creator>mzemaitis</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Desktop Search uninstall]]></category>

		<guid isPermaLink="false">http://mzemaitis.wordpress.com/?p=5</guid>
		<description><![CDATA[Some notes about Windows Desktop Search, well, for some people it may be a very good tool. I thought it should help me a lot to find my files. But wait, what a resource eater this WDS is, and really after 2 years of using it I didn&#8217;t become satisfactory with search results at all.
So [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=5&subd=mzemaitis&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Some notes about Windows Desktop Search, well, for some people it may be a very good tool. I thought it should help me a lot to find my files. But wait, what a resource eater this WDS is, and really after 2 years of using it I didn&#8217;t become satisfactory with search results at all.<br />
So I decided to uninstall it. Everything should be as always when you uninstall any MS program &#8211; simple, but really not for WDS.<br />
I uninstalled it from &#8220;Add/Remove programs&#8221; control panel. OK, finished, restart. WDS doesn&#8217;t start and seems gone.</p>
<p>But later, when  I pressed F3 in MyPC for file searching, and instead of standard simple windows search I SEE all again Windows Desktop Search, damn&#8230; Seems, it wasn&#8217;t full uninstall. Then I thought, I will install it again a fresh copy, and then I will uninstall. I downloaded an WDS EN 3.01 version from Microsoft website. Installed it. Going to remove in &#8220;Add/Remove Programs&#8221;, well&#8230;. it shows no WDS is installed (even with &#8220;Show updates&#8221; option). WTF. Though it clearly runs with my every computer start. So how to get rid of this thing without reinstalling all my pc??</p>
<p>Searching the google&#8230;<br />
I found some information from Microsoft:</p>
<p><a class="navigation" href="http://www.microsoft.com/technet/prodtechnol/windows/search/dtstshoot.mspx" target="_blank">http://www.microsoft.com/technet/prodtechnol/windows/search/dtstshoot.mspx</a> .</p>
<p>But man I didn&#8217;t install neither MSN search toolbars, nor other MS stuff, just WDS. Not useful information.<br />
Found some instructions from Kotsar Andrew:</p>
<p><a class="navigation" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1456784&amp;SiteID=1" target="_blank">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1456784&amp;SiteID=1</a> .</p>
<p>OMG you need to create a WDS uninstall information manually, because I didn&#8217;t find such uninstall information even in my Windows dir (it should be hidden system folder with $KB&#8230;.). <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> (.<br />
But then again I found a very good instructions here:</p>
<p><a class="navigation" href="http://www.davidarno.org/2007/10/26/how-to-remove-windows-desktop-search/" target="_blank">http://www.davidarno.org/2007/10/26/how-to-remove-windows-desktop-search/</a> .</p>
<p>Well seems I am not the only one here with WDS. Luckily I had another computer with WDS installed and uninstall information present there. So you need to copy that information to your Windows directory (for WDS 3.01 it should be <span style="color:#993300;">$NtUninstallKB917013$</span>, hidden system folder ) and manually run <span style="color:#993300;">spuninst.exe</span>. Then it should uninstall.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mzemaitis.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mzemaitis.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mzemaitis.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mzemaitis.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mzemaitis.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mzemaitis.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mzemaitis.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mzemaitis.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mzemaitis.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mzemaitis.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mzemaitis.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mzemaitis.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=5&subd=mzemaitis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mzemaitis.wordpress.com/2008/04/16/how-to-uninstall-windows-desktop-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a31ca29806040496185881ddc47fb76?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">mzemaitis</media:title>
		</media:content>
	</item>
		<item>
		<title>FileStream Create error in Delphi</title>
		<link>http://mzemaitis.wordpress.com/2008/04/16/filestream-create-error-in-delphi/</link>
		<comments>http://mzemaitis.wordpress.com/2008/04/16/filestream-create-error-in-delphi/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 07:07:52 +0000</pubDate>
		<dc:creator>mzemaitis</dc:creator>
				<category><![CDATA[Delphi tips]]></category>
		<category><![CDATA[FileStream Create Error]]></category>

		<guid isPermaLink="false">http://mzemaitis.wordpress.com/?p=4</guid>
		<description><![CDATA[ I&#8217;ll share some tip on File Creation in Delphi. Some day I had to make a solution to create same file stream a lot times in a cycle and to show it at regular intervals (it was opened in another application). Well, if file is already created and time interval get&#8217;s too short, you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=4&subd=mzemaitis&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mzemaitis.files.wordpress.com/2009/06/refresh1.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 4px 4px 0;" title="Refresh" border="0" alt="Refresh" align="left" src="http://mzemaitis.files.wordpress.com/2009/06/refresh_thumb1.png?w=128&#038;h=128" width="128" height="128" /></a> I&#8217;ll share some tip on File Creation in Delphi. Some day I had to make a solution to create same file stream a lot times in a cycle and to show it at regular intervals (it was opened in another application). Well, if file is already created and time interval get&#8217;s too short, you might get an exception, that file is &quot;in use on another process&quot; and even setting file permissions doesn&#8217;t help:</p>
<p style="padding-left:30px;"><span style="color:#003366;"></span>
<p style="padding-left:30px;"><span style="color:#003366;"></span>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> var File : TFileStream </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> File := TFileStream.Create(OutputFile, fmCreate <span style="color:#0000ff;">or</span> fmShareExclusive)</pre>
<p><!--CRLF--></div>
</p></div>
</p>
<p>The solution is, first to check out if file is in use. We could use Windows API <strong>CreateFile</strong> function for this task:</p>
<p style="padding-left:30px;"><span style="color:#003366;"></span></p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> function IsFileInUse(FileName: TFileName): Boolean;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>   var HFileRes: HFILE;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span> begin</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>   Result := False;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>   <span style="color:#0000ff;">if</span> not FileExists(FileName) then Exit;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>   HFileRes := CreateFile( PChar(FileName), <span style="color:#008000;">//Windows API Create</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span>     GENERIC_READ or GENERIC_WRITE, 0, nil, OPEN_EXISTING,</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span>     FILE_ATTRIBUTE_NORMAL, 0);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span>   Result := (HFileRes = INVALID_HANDLE_VALUE);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span>   <span style="color:#008000;">//returns false File handle if file is in use</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span>   <span style="color:#0000ff;">if</span> not Result then CloseHandle(HFileRes); <span style="color:#008000;">//Deny and close handle</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  12:</span> end;</pre>
<p><!--CRLF--></div>
</p></div>
</p>
<p>Then you can check if file is in use:</p>
<p style="padding-left:30px;"><span style="color:#003366;"></span></p>
<p style="padding-left:30px;"><span style="color:#003366;"></span></p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">if</span> NOT IsFileInUse(OutputFile)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>    then File := TFileStream.Create(OutputFile, fmCreate or  fmShareExclusive);</pre>
<p><!--CRLF--></div>
</p></div>
</p>
<p>update: <strong>Zarko Gajis</strong> from About.com made another universal function for checking if &quot;FileIsInUse&quot; here:</p>
<p><a href="http://delphi.about.com/od/delphitips2009/qt/is-file-in-use.htm" target="_blank">Programmatically Check If File is In Use &#8211; Delphi Code</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mzemaitis.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mzemaitis.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mzemaitis.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mzemaitis.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mzemaitis.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mzemaitis.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mzemaitis.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mzemaitis.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mzemaitis.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mzemaitis.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mzemaitis.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mzemaitis.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mzemaitis.wordpress.com&blog=3496207&post=4&subd=mzemaitis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mzemaitis.wordpress.com/2008/04/16/filestream-create-error-in-delphi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a31ca29806040496185881ddc47fb76?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">mzemaitis</media:title>
		</media:content>

		<media:content url="http://mzemaitis.files.wordpress.com/2009/06/refresh_thumb1.png" medium="image">
			<media:title type="html">Refresh</media:title>
		</media:content>
	</item>
	</channel>
</rss>