<?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>phdesign &#187; phreplace</title>
	<atom:link href="http://www.phdesign.com.au/tag/phreplace/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phdesign.com.au</link>
	<description>phdesign web and application development by Paul Heasley</description>
	<lastBuildDate>Sun, 22 Jan 2012 22:17:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>phreplace Goes Open Source</title>
		<link>http://www.phdesign.com.au/general/phreplace-goes-open-source/</link>
		<comments>http://www.phdesign.com.au/general/phreplace-goes-open-source/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 08:09:48 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[phreplace]]></category>

		<guid isPermaLink="false">http://www.phdesign.com.au/?p=193</guid>
		<description><![CDATA[I&#8217;ve decided to release phreplace as open source software in order to continue it&#8217;s development, I no longer have the time to give it the attention it deserves. The VB6 source code will be released under the GNU Lesser General Public License (LGPL), in my understanding this means that anyone can use phreplace and even [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to release phreplace as open source software in order to continue it&#8217;s development, I no longer have the time to give it the attention it deserves.</p>
<p>The VB6 source code will be released under the GNU Lesser General Public License (LGPL), in my understanding this means that anyone can use phreplace and even include the library in a greater works (e.g. PSPad), however if they modify the code it must be released under a similar open source library, in order that everyone will benefit from the changes.</p>
<p>The source code is available at <a title="phreplace source code available at Assembla" href="https://www.assembla.com/spaces/phreplace/documents">Assembla</a>, feel free to send any code changes to me to be included in the project.<span id="more-193"></span></p>
<h3>Architecture</h3>
<p>I rewrote phreplace in early 2009 when I was studying design patterns and as such the VB6 source code is heavily object-oriented and pattern focused. VB6 is not strictly an oo language but it does support inheritance through the &#8216;Implements&#8217; keyword.</p>
<p>phreplace uses the iterator, observer and factory methods. I found some of the sample chapters of <em>Visual Basic design patterns: VB 6.0 and VB.NET</em> By James William Cooper on <a title="Visual Basic design patterns: VB 6.0 and VB.NET By James William Cooper" href="http://books.google.com.au/books?id=TLhvRJTKDssC&amp;lpg=PP1&amp;pg=PP1#v=onepage&amp;q&amp;f=false">Google Books</a> a very useful resource.</p>
<p>This early <a href="http://www.phdesign.com.au/wp-content/uploads/2010/06/phreplace-architecture.pdf">class architecture diagram (PDF)</a> may help decipher some of the code design.</p>
<h3>Future Direction</h3>
<p>phreplace was designed to be application agnostic, it currently works only with PSPad but I hoped that by implementing only a few interfaces (IHostAdapter, IDocument and IDocumentCollection) it could work with any other editor that supported the basic operations required. My next intended editor to support was SciTE.</p>
<p>The first major change that I would like to see is support for Vista / Windows 7. At present the phreplace.vbs script intialises the application by checking to see if the phreplace.dll library is registered, if it isn&#8217;t it tries to register it with regsvr32. This works for Windows XP but standard users aren&#8217;t able to register libraries in Vista / Windows 7. So far I have come up with 3 solutions.</p>
<ol>
<li>Override DllRegisterServer using <a title="Classic VB Tools: vbAdvance" href="http://vb.mvps.org/tools/vbAdvance/">vbAdvance</a>. I can&#8217;t get this library to work. See <a href="http://www.phdesign.com.au/programming/registering-phreplace-dll-in-windows-vista/" title="Registering phreplace DLL in Windows Vista">Registering phreplace DLL in Windows Vista</a>.</li>
<li>Create a separate utility similar to regsvr32 and include this with phreplace. I think this is messy. Again see <a href="http://www.phdesign.com.au/programming/registering-phreplace-dll-in-windows-vista/" title="Registering phreplace DLL in Windows Vista">Registering phreplace DLL in Windows Vista</a>.</li>
<li>Use the <a title="Registration-Free COM" href="http://msdn.microsoft.com/en-us/library/ms973913.aspx">Registration-Free COM</a> solution of adding a manifest file for PSPad which references the phreplace.dll library so that we don&#8217;t have to register it in the registry at all. This solution works for XP, see the <a title="reg-free-com branch of phreplace source code." href="https://www.assembla.com/code/phreplace/subversion/nodes/branches/reg-free-com?rev=5">reg-free-com branch of the source code</a>, but doesn&#8217;t seem to work for Vista. My theory is that perhaps Vista handles vbscript differently, so it doesn&#8217;t inherit the PSPad manifest. If someone could get this working I think this is the most elegant solution.</li>
</ol>
<p>I look forward to seeing user contributions to this project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phdesign.com.au/general/phreplace-goes-open-source/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Registering phreplace DLL in Windows Vista</title>
		<link>http://www.phdesign.com.au/programming/registering-phreplace-dll-in-windows-vista/</link>
		<comments>http://www.phdesign.com.au/programming/registering-phreplace-dll-in-windows-vista/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 10:10:46 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[phreplace]]></category>
		<category><![CDATA[vb6]]></category>

		<guid isPermaLink="false">http://www.phdesign.com.au/?p=165</guid>
		<description><![CDATA[is a VB6 DLL which is called from a vbscript plugin for PSPad. The script tests to see if the correct version of the DLL is registered on this computer, if not it registers it using regsvr32. This works fine in XP but not Vista where the script will error. A while ago a user [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.phdesign.com.au/phreplace/" title="phreplace Multiline search / replace for PSPad">phreplace</a> is a VB6 DLL which is called from a vbscript plugin for <a title="PSPad editor for developers" href="http://www.pspad.com/">PSPad</a>. The script tests to see if the correct version of the DLL is registered on this computer, if not it registers it using regsvr32. This works fine in XP but not Vista where the script will error.</p>
<p>A while ago a user pointed out to me <a title="Self Registering DLL's" href="http://www.experts-exchange.com/Programming/System/Windows__Programming/Q_21243930.html">this article on Experts Exchange</a> explaining why administrative rights are required to register a DLL in Windows Vista, in the hopes that we could automate the registration of phreplace in Vista.<span id="more-165"></span></p>
<p>Feeling defeated, I decided to explain why I haven&#8217;t been able to do this yet.</p>
<p>The fundamental problem is that Vista requires administrative privledges to write to the registry key required to register DLLs:</p>
<p>HKEY_CLASSES_ROOT\</p>
<p>However the user can register DLLs in their own section of the registry:</p>
<p>HKEY_CURRENT_USER\SOFTWARE\Classes\</p>
<p>So all is well right? Well not if you&#8217;re using VB6, you see when you run regsvr32, it calls the methods DllRegisterSever and DllUnregisterSever  to add / remove entries from the registry, these methods are generated automatically by VB6 to register to HKEY_CLASSES_ROOT, and there is no way to change this.</p>
<p>Well, there is one way. Apparently the <a title="vbAdvance Visual Basic addon" href="http://vb.mvps.org/tools/vbAdvance/">vbAdvance</a> addon for VB6 allowed a user to customise DllRegisterServer / DllUnregisterServer, this sounds great, except that it doesn&#8217;t work. I tried modifying these methods according to the instruction, but the resulting DLL just wont register. I even tried registering the included example DLL in the download package, but this threw the same error.</p>
<p>I&#8217;m certain it must have worked at some stage, they wouldn&#8217;t have included an example that didn&#8217;t work, so I can&#8217;t figure out what&#8217;s different. Did it only work in Windows 98 or 2000?</p>
<p>So in summary, for as long as I&#8217;m using VB6 I don&#8217;t think I can change where phreplace tries to register the DLL, the only other workaround is to use RegOverridePredefKey to tell the registry to redirect any calls to HKEY_CLASSES_ROOT to HKEY_CURRENT_USER\SOFTWARE\Classes, this would work but I don&#8217;t think it can be done with vbscript, so I would need to add another executable to phreplace to use in registering / unregistering the DLL from the registry, seems pretty messy.</p>
<p>If you&#8217;ve got any tips for me (especially how I can customise DllRegisterServer) feel free to email me. I haven&#8217;t setup the facility for leaving comments on this site yet, sorry.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phdesign.com.au/programming/registering-phreplace-dll-in-windows-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phreplace version 2.0.24 released</title>
		<link>http://www.phdesign.com.au/general/phreplace-version-2-0-24-released/</link>
		<comments>http://www.phdesign.com.au/general/phreplace-version-2-0-24-released/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 04:21:52 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[phreplace]]></category>

		<guid isPermaLink="false">http://www.phdesign.com.au/?p=137</guid>
		<description><![CDATA[I&#8217;ve made a couple of updates to phreplace and created a new . The changes include: Handling an exception that occurs in the vbscript Regex object when using a badly formed regular expression (e.g. reader.(\w)+\(reader.GetOrdinal\(&#8220;(\w)+&#8221;)); &#8211; note I forgot to escape the last parenthesis). Added Write to Log option (which defaults to off) to write some debugging [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a couple of updates to phreplace and created a new <a href="http://www.phdesign.com.au/phreplace/" title="phreplace">version 2.0.24 which is available here</a>. The changes include:<span id="more-137"></span></p>
<ul>
<li>Handling an exception that occurs in the vbscript Regex object when using a badly formed regular expression (e.g. reader.(\w)+\(reader.GetOrdinal\(&#8220;(\w)+&#8221;)); &#8211; note I forgot to escape the last parenthesis).</li>
<li>Added Write to Log option (which defaults to off) to write some debugging log events to a &#8216;phreplace.log&#8217; file in the same folder as the &#8216;phreplace.dll&#8217; library. This should help identify the issue for a user where the latest version of phreplace just doesn&#8217;t open (no error &#8211; no nothing).</li>
<li>Not a change but rather a note: Tried to understand the vbscript Regex object&#8217;s handling of &#8216;.&#8217;. Apparently it matches a new line (\n) but not a carriage return (\r) which is why doing a replace all with ^(.+)$  was acting  strange, try this instead ^([^\r\n]+)$.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.phdesign.com.au/general/phreplace-version-2-0-24-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phreplace Documentation Online</title>
		<link>http://www.phdesign.com.au/general/phreplace-documentation-online/</link>
		<comments>http://www.phdesign.com.au/general/phreplace-documentation-online/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 11:08:24 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[phreplace]]></category>

		<guid isPermaLink="false">http://www.phdesign.com.au/apps/staging/?p=115</guid>
		<description><![CDATA[The documentation for phreplace which was included as a .chm file in version 2.0 is now available online.]]></description>
			<content:encoded><![CDATA[<p>The documentation for <a href="http://www.phdesign.com.au/phreplace/" title="phreplace">phreplace</a> which was included as a .chm file in version 2.0 is now <a href="http://www.phdesign.com.au/docs/introduction/" title="Introduction">available online</a>. While viewing the documentation use the menu on the right hand side to navigate.</p>
<p>The docs include <a href="http://www.phdesign.com.au/docs/support-and-development/" title="Support and Development">information on getting support</a>, <a href="http://www.phdesign.com.au/docs/troubleshooting/" title="Troubleshooting">troubleshooting</a> and <a href="http://www.phdesign.com.au/docs/version-history/" title="Version History">version history</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phdesign.com.au/general/phreplace-documentation-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

