<?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>dotFusion.net</title>
	<atom:link href="http://www.dotfusion.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dotfusion.net</link>
	<description>Programming tips. Free apps. Freelance website building.</description>
	<lastBuildDate>Mon, 19 Dec 2011 08:31:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>gsub2srt 0.1, a sub2srt GUI released</title>
		<link>http://www.dotfusion.net/gsub2srt-0-1-released</link>
		<comments>http://www.dotfusion.net/gsub2srt-0-1-released#comments</comments>
		<pubDate>Mon, 21 Mar 2011 19:29:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Plain C]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Free Tool]]></category>
		<category><![CDATA[Freeware]]></category>
		<category><![CDATA[GPL]]></category>
		<category><![CDATA[GPLv2]]></category>
		<category><![CDATA[GTK]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Open and Save Dialog]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.dotfusion.net/?p=265</guid>
		<description><![CDATA[Hi everybody! I didn&#8217;t write for such a long time. Last months I don&#8217;t have enough free time to work on my favourite spare time projects. I&#8217;m publishing a link to the sub2srt GUI application rewritten in plain C using the GTK+ runtime.&#160; Right now the application works on Unix/Linux/*BSD. It won&#8217;t be much porting [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everybody! I didn&#8217;t write for such a long time. Last months I don&#8217;t have enough free time to work on my favourite spare time projects. I&#8217;m publishing a link to the sub2srt GUI application rewritten in plain C using the GTK+ runtime.<br />&nbsp;</p>
<p>Right now the application works on Unix/Linux/*BSD. It won&#8217;t be much porting to make it work on Windows which will probably be done in the next version.<br />&nbsp;</p>
<p><a href="http://code.google.com/p/gsub2srt/" target="_blank">Go to gsub2srt project website</a><br />&nbsp;<br />
<img src="/gsub2srt/screenshot.png" alt="gsub2srt screenshot" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotfusion.net/gsub2srt-0-1-released/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Source code numberings remover 0.2</title>
		<link>http://www.dotfusion.net/source-code-numberings-remover-0-2-2</link>
		<comments>http://www.dotfusion.net/source-code-numberings-remover-0-2-2#comments</comments>
		<pubDate>Thu, 10 Jun 2010 12:12:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Cross-platform]]></category>
		<category><![CDATA[Free Tool]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Multi-platform]]></category>
		<category><![CDATA[Numberings remover]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://192.168.1.2/blog/?p=257</guid>
		<description><![CDATA[Didn&#8217;t write for a long time. Just a quick post to add the new version of my Source code numberings remover&#8230; #ifndef __linux__ #include &#60;conio.h&#62; #else #include &#34;getch.h&#34; #endif &#160; #include &#60;stdio.h&#62; #include &#60;stdlib.h&#62; #include &#60;iostream&#62; #include &#60;fstream&#62; #include &#60;cstring&#62; &#160; using namespace std; &#160; void RemStartingChars&#40;string &#38;input, bool spacesRemoved&#41; &#123; if &#40;!spacesRemoved&#41; while &#40;input&#91;0&#93; [...]]]></description>
			<content:encoded><![CDATA[<p>Didn&#8217;t write for a long time. Just a quick post to add the new version of my Source code numberings remover&#8230;<br />
</p>
<blockquote>

<div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#ifndef __linux__</span>
       <span style="color: #339900;">#include &lt;conio.h&gt;</span>
<span style="color: #339900;">#else</span>
       <span style="color: #339900;">#include &quot;getch.h&quot;</span>
<span style="color: #339900;">#endif</span>
&nbsp;
<span style="color: #339900;">#include &lt;stdio.h&gt;</span>
<span style="color: #339900;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339900;">#include &lt;iostream&gt;</span>
<span style="color: #339900;">#include &lt;fstream&gt;</span>
<span style="color: #339900;">#include &lt;cstring&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">void</span> RemStartingChars<span style="color: #008000;">&#40;</span>string <span style="color: #000040;">&amp;</span>input, <span style="color: #0000ff;">bool</span> spacesRemoved<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
         <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>spacesRemoved<span style="color: #008000;">&#41;</span>
               <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>input<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">' '</span><span style="color: #008000;">&#41;</span>
                    input <span style="color: #000080;">=</span> input.<span style="color: #007788;">substr</span><span style="color: #008000;">&#40;</span> <span style="color: #0000dd;">1</span>, <span style="color: #0000dd;">strlen</span><span style="color: #008000;">&#40;</span>input.<span style="color: #007788;">c_str</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
         <span style="color: #0000ff;">char</span> numbers<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span><span style="color: #FF0000;">'0'</span>, <span style="color: #FF0000;">'1'</span>, <span style="color: #FF0000;">'2'</span>, <span style="color: #FF0000;">'3'</span>, <span style="color: #FF0000;">'4'</span>, <span style="color: #FF0000;">'5'</span>, <span style="color: #FF0000;">'6'</span>, <span style="color: #FF0000;">'7'</span>, <span style="color: #FF0000;">'8'</span>, <span style="color: #FF0000;">'9'</span><span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
         <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
         <span style="color: #0000ff;">bool</span> hasMore <span style="color: #000080;">=</span> <span style="color: #0000ff;">false</span>, tmp <span style="color: #000080;">=</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span>
&nbsp;
         <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>numbers<span style="color: #008000;">&#91;</span><span style="color: #000040;">++</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
               <span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span>tmp <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>input<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> numbers<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
               <span style="color: #008000;">&#123;</span>
                     hasMore <span style="color: #000080;">=</span> hasMore <span style="color: #000040;">||</span> tmp<span style="color: #008080;">;</span>
                     input <span style="color: #000080;">=</span> input.<span style="color: #007788;">substr</span><span style="color: #008000;">&#40;</span> <span style="color: #0000dd;">1</span>, <span style="color: #0000dd;">strlen</span><span style="color: #008000;">&#40;</span>input.<span style="color: #007788;">c_str</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
               <span style="color: #008000;">&#125;</span>
&nbsp;
         <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>hasMore<span style="color: #008000;">&#41;</span>
            RemStartingChars<span style="color: #008000;">&#40;</span>input, <span style="color: #0000ff;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>argv<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Source code numberings remover 0.2&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Written by Iskren Slavov&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Copyright (C) 2009,2010&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
&nbsp;
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>This computer software must be &quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;redistributed and edited under the terms of GNU GPLv2. &quot;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;For more information about licensing read COPYING file.<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
&nbsp;
&nbsp;
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>argc <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
                 ifstream inFile<span style="color: #008080;">;</span>
                 ofstream outFile<span style="color: #008080;">;</span>
&nbsp;
                 inFile.<span style="color: #007788;">open</span><span style="color: #008000;">&#40;</span>argv<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                 outFile.<span style="color: #007788;">open</span><span style="color: #008000;">&#40;</span>argv<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
                 <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>inFile<span style="color: #008000;">&#41;</span>
                 <span style="color: #008000;">&#123;</span>
                    <span style="color: #0000dd;">cerr</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Unable to open file: &quot;</span><span style="color: #000080;">&lt;&lt;</span>argv<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
                    <span style="color: #0000dd;">system</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;PAUSE&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                    <span style="color: #0000dd;">exit</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                 <span style="color: #008000;">&#125;</span>
&nbsp;
                 string input<span style="color: #008080;">;</span>
                 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;=========================<span style="color: #000099; font-weight: bold;">\n</span>Converting... &quot;</span><span style="color: #008080;">;</span>
                 <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>getline<span style="color: #008000;">&#40;</span>inFile, input<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                 <span style="color: #008000;">&#123;</span>
                       RemStartingChars<span style="color: #008000;">&#40;</span>input, <span style="color: #0000ff;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                       outFile<span style="color: #000080;">&lt;&lt;</span>input<span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
                 <span style="color: #008000;">&#125;</span>
                 <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;All done!<span style="color: #000099; font-weight: bold;">\n</span>=========================&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
&nbsp;
                 outFile.<span style="color: #007788;">flush</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                 outFile.<span style="color: #007788;">close</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                 inFile.<span style="color: #007788;">close</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
		<span style="color: #0000ff;">else</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #339900;">#ifdef __linux__</span>
            			<span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span> progname <span style="color: #000080;">=</span> argv<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
			<span style="color: #339900;">#else</span>
						<span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span> progname <span style="color: #000080;">=</span> <span style="color: #0000dd;">strrchr</span><span style="color: #008000;">&#40;</span>argv<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span>, <span style="color: #FF0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">+</span><span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
			<span style="color: #339900;">#endif</span>
            <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;================================================================&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
            <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Description: Removes leading numbers from source code.&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
            <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Usage: &quot;</span><span style="color: #000080;">&lt;&lt;</span>progname<span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot; &lt;input-file.txt&gt; &lt;output-file.txt&gt;&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
            <span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;================================================================&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
      		<span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;Press any key to exit . . .&quot;</span><span style="color: #000080;">&lt;&lt;</span>endl<span style="color: #008080;">;</span>
&nbsp;
      		<span style="color: #339900;">#ifdef __linux__</span>
            	<span style="color: #0000dd;">getchar</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #339900;">#else</span>
            	getch<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #339900;">#endif</span>
		<span style="color: #008000;">&#125;</span>
        <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span></pre></div>
<p><a href="http://www.dotfusion.net/wordpress/wp-content/uploads/2010/06/remfirstnums-0.2.zip">Source code numberings remover 0.2</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.dotfusion.net/source-code-numberings-remover-0-2-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vista Compatible Open/Save Dialogs in Lazarus</title>
		<link>http://www.dotfusion.net/vista-compatible-open-and-save-dialog-in-lazarus-freepascal</link>
		<comments>http://www.dotfusion.net/vista-compatible-open-and-save-dialog-in-lazarus-freepascal#comments</comments>
		<pubDate>Fri, 28 Aug 2009 12:05:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Lazarus (FreePascal)]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Lazarus]]></category>
		<category><![CDATA[Open and Save Dialog]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[Windows Vista]]></category>
		<category><![CDATA[Windows Vista Compatible]]></category>

		<guid isPermaLink="false">http://www.dotfusion.net/?p=162</guid>
		<description><![CDATA[I&#8217;ve been trying to get Vista Compatible Open and Save Dialogs in Lazarus (FreePascal) recently. After researching I found some example code around the net which didn&#8217;t quite work in FreePascal. I modified and extended the code and the result is here: &#160; &#160;And now the source code&#8230; { VistaOpenSaveDialog: A new Open/Save dialog that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying to get Vista Compatible Open and Save Dialogs in Lazarus (FreePascal) recently. After researching I found some example code around the net which didn&#8217;t quite work in FreePascal. I modified and extended the code and the result is here:<br />
</p>
<div>
<div id="attachment_168" class="wp-caption alignleft" style="width: 353px"><img class="size-full wp-image-168" title="Default Lazarus Open Dialog" src="http://www.dotfusion.net/wordpress/wp-content/uploads/2009/08/opendlg_before.jpg" alt="Default Lazarus Open Dialog" width="343" height="251" /><p class="wp-caption-text">(Default Lazarus Open Dialog)</p></div><br />
<div id="attachment_169" class="wp-caption alignleft" style="width: 376px"><img class="size-full wp-image-169" title="Vista Compatible Open Dialog" src="http://www.dotfusion.net/wordpress/wp-content/uploads/2009/08/opendlg_after.jpg" alt="Vista Compatible Open Dialog" width="366" height="288" /><p class="wp-caption-text">(Vista Compatible Open Dialog)</p></div>
</div>
<div class="clear"></div>
<p>&nbsp;</p>
<div>
<div id="attachment_170" class="wp-caption alignleft" style="width: 353px"><img class="size-full wp-image-170" title="Default Lazarus Save Dialog" src="http://www.dotfusion.net/wordpress/wp-content/uploads/2009/08/savedlg_before.jpg" alt="Default Lazarus Save Dialog" width="343" height="253" /><p class="wp-caption-text">(Default Lazarus Save Dialog)</p></div><br />
<div id="attachment_171" class="wp-caption alignleft" style="width: 376px"><img class="size-full wp-image-171" title="Vista Compatible Save Dialog" src="http://www.dotfusion.net/wordpress/wp-content/uploads/2009/08/savedlg_after.jpg" alt="Vista Compatible Save Dialog" width="366" height="288" /><p class="wp-caption-text">(Vista Compatible Save Dialog)</p></div>
</div>
<div class="clr"></div>
<p>&nbsp;<br /><strong>And now the source code&#8230;</strong></p>
<blockquote>

<div class="code"><pre class="delphi" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">{
  VistaOpenSaveDialog:
  A new Open/Save dialog that uses Windows API to display Vista
  compatiable Open or Save Dialog.
&nbsp;
  Tested in Windows 2000/XP/Vista/Vista x64.
  Compiled with Lazarus 0.9.29 beta (21448) / FreePascal 2.2.4
  It should compile successfully with all newer and maybe some the versions.
&nbsp;
  Created by Iskren Slavov (http://www.dotfusion.net/).
  No right reserved. Feel free to use for any of your applications
  regardless of the license.
&nbsp;
  ##########################################
&nbsp;
  Example usage:
  VistaOpenSaveDialg(Handle, '', '', '', 'Open file...', fileName,
    OFN_FILEMUSTEXIST, VDT_OPENDIALOG);
&nbsp;
  Some usable flags under Windows Vista:
  OFN_READONLY, OFN_HIDEREADONLY, 
  OFN_OVERWRITEPROMPT, OFN_FILEMUSTEXIST,
  OFN_PATHMUSTEXIST, OFN_FORCESHOWHIDDEN, 
  OFN_DONTADDTORECENT
}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">unit</span> VistaOpenSaveDlg<span style="color: #000066;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic;">{$mode objfpc}{$H+}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows<span style="color: #000066;">,</span> Messages<span style="color: #000066;">,</span> CommDlg<span style="color: #000066;">,</span> SysUtils<span style="color: #000066;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TVistaDlgType <span style="color: #000066;">=</span> <span style="color: #000066;">&#40;</span>VDT_OPENDIALOG<span style="color: #000066;">,</span> VDT_SAVEDIALOG<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">function</span> ReplaceStr<span style="color: #000066;">&#40;</span><span style="color: #000000; font-weight: bold;">const</span> S<span style="color: #000066;">,</span> Srch<span style="color: #000066;">,</span> Replace<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">string</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">string</span><span style="color: #000066;">;</span>
  <span style="color: #000000; font-weight: bold;">function</span> VistaOpenSaveDialog<span style="color: #000066;">&#40;</span>Parent<span style="color: #000066;">:</span> HWND<span style="color: #000066;">;</span> <span style="color: #000000; font-weight: bold;">const</span> Filters<span style="color: #000066;">,</span> 
    DefaultExtension<span style="color: #000066;">,</span> InitialDir<span style="color: #000066;">,</span> Title<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">string</span><span style="color: #000066;">;</span> <span style="color: #000000; font-weight: bold;">var</span> FileName<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">string</span><span style="color: #000066;">;</span> 
    DlgFlags<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">DWORD</span><span style="color: #000066;">;</span> DlgType<span style="color: #000066;">:</span> TVistaDlgType<span style="color: #000066;">&#41;</span><span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">Boolean</span><span style="color: #000066;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> ReplaceStr<span style="color: #000066;">&#40;</span><span style="color: #000000; font-weight: bold;">const</span> S<span style="color: #000066;">,</span> Srch<span style="color: #000066;">,</span> Replace<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">string</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">string</span><span style="color: #000066;">;</span>
<span style="color: #000000; font-weight: bold;">var</span>
  i<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">Integer</span><span style="color: #000066;">;</span>
  Source<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">string</span><span style="color: #000066;">;</span>
<span style="color: #000000; font-weight: bold;">begin</span>
  Source <span style="color: #000066;">:</span><span style="color: #000066;">=</span> S<span style="color: #000066;">;</span>
  Result <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #ff0000;">''</span><span style="color: #000066;">;</span>
  <span style="color: #000000; font-weight: bold;">repeat</span>
    i <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066;">Pos</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">UpperCase</span><span style="color: #000066;">&#40;</span>Srch<span style="color: #000066;">&#41;</span><span style="color: #000066;">,</span> <span style="color: #000066;">UpperCase</span><span style="color: #000066;">&#40;</span>Source<span style="color: #000066;">&#41;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> i &gt; <span style="color: #0000ff;">0</span> <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #000000; font-weight: bold;">begin</span>
      Result <span style="color: #000066;">:</span><span style="color: #000066;">=</span> Result <span style="color: #000066;">+</span> <span style="color: #000066;">Copy</span><span style="color: #000066;">&#40;</span>Source<span style="color: #000066;">,</span> <span style="color: #0000ff;">1</span><span style="color: #000066;">,</span> i <span style="color: #000066;">-</span> <span style="color: #0000ff;">1</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">+</span> Replace<span style="color: #000066;">;</span>
      Source <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066;">Copy</span><span style="color: #000066;">&#40;</span>Source<span style="color: #000066;">,</span> i <span style="color: #000066;">+</span> <span style="color: #000066;">Length</span><span style="color: #000066;">&#40;</span>Srch<span style="color: #000066;">&#41;</span><span style="color: #000066;">,</span> MaxInt<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    <span style="color: #000000; font-weight: bold;">end</span>
    <span style="color: #000000; font-weight: bold;">else</span>
      Result <span style="color: #000066;">:</span><span style="color: #000066;">=</span> Result <span style="color: #000066;">+</span> Source<span style="color: #000066;">;</span>
  <span style="color: #000000; font-weight: bold;">until</span> i &lt;<span style="color: #000066;">=</span> <span style="color: #0000ff;">0</span><span style="color: #000066;">;</span>
<span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> VistaOpenSaveDialog<span style="color: #000066;">&#40;</span>Parent<span style="color: #000066;">:</span> HWND<span style="color: #000066;">;</span> <span style="color: #000000; font-weight: bold;">const</span> Filters<span style="color: #000066;">,</span> DefaultExtension<span style="color: #000066;">,</span> InitialDir<span style="color: #000066;">,</span> Title<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">String</span><span style="color: #000066;">;</span>
  <span style="color: #000000; font-weight: bold;">var</span> FileName<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">String</span><span style="color: #000066;">;</span> DlgFlags<span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">DWORD</span><span style="color: #000066;">;</span> DlgType<span style="color: #000066;">:</span> TVistaDlgType<span style="color: #000066;">&#41;</span><span style="color: #000066;">:</span> <span style="color: #000066; font-weight: bold;">Boolean</span><span style="color: #000066;">;</span>
<span style="color: #000000; font-weight: bold;">var</span>
  fnStruct<span style="color: #000066;">:</span> TOpenFileName<span style="color: #000066;">;</span>
  szFile<span style="color: #000066;">:</span> <span style="color: #000000; font-weight: bold;">array</span><span style="color: #000066;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #000066;">..</span><span style="color: #006600;">MAX_PATH</span><span style="color: #000066;">&#93;</span> <span style="color: #000000; font-weight: bold;">of</span> <span style="color: #000066; font-weight: bold;">Char</span><span style="color: #000066;">;</span>
<span style="color: #000000; font-weight: bold;">begin</span>
  Result <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000000; font-weight: bold;">False</span><span style="color: #000066;">;</span>
  <span style="color: #000066;">FillChar</span><span style="color: #000066;">&#40;</span>fnStruct<span style="color: #000066;">,</span> <span style="color: #000066;">SizeOf</span><span style="color: #000066;">&#40;</span>TOpenFileName<span style="color: #000066;">&#41;</span><span style="color: #000066;">,</span> <span style="color: #0000ff;">0</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
  <span style="color: #000000; font-weight: bold;">with</span> fnStruct <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #000000; font-weight: bold;">begin</span>
    hwndOwner <span style="color: #000066;">:</span><span style="color: #000066;">=</span> Parent<span style="color: #000066;">;</span>
    lStructSize <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066;">SizeOf</span><span style="color: #000066;">&#40;</span>TOpenFileName<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    lpstrFile <span style="color: #000066;">:</span><span style="color: #000066;">=</span> szFile<span style="color: #000066;">;</span>
    <span style="color: #000066;">StrPCopy</span><span style="color: #000066;">&#40;</span>lpstrFile<span style="color: #000066;">,</span> FileName<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    nMaxFile <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066;">SizeOf</span><span style="color: #000066;">&#40;</span>szFile<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    lpstrFilter <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066; font-weight: bold;">PChar</span><span style="color: #000066;">&#40;</span>ReplaceStr<span style="color: #000066;">&#40;</span>Filters<span style="color: #000066;">,</span> <span style="color: #ff0000;">'|'</span><span style="color: #000066;">,</span> <span style="color: #ff0000;">#0</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">+</span> <span style="color: #ff0000;">#0</span><span style="color: #ff0000;">#0</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000066;">&#40;</span>Title &lt;&gt; <span style="color: #ff0000;">''</span><span style="color: #000066;">&#41;</span> <span style="color: #000000; font-weight: bold;">then</span>
      lpstrTitle <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066; font-weight: bold;">PChar</span><span style="color: #000066;">&#40;</span>Title<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000066;">&#40;</span>InitialDir &lt;&gt; <span style="color: #ff0000;">''</span><span style="color: #000066;">&#41;</span> <span style="color: #000000; font-weight: bold;">then</span>
      lpstrInitialDir <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066; font-weight: bold;">PChar</span><span style="color: #000066;">&#40;</span>InitialDir<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> DefaultExtension &lt;&gt; <span style="color: #ff0000;">''</span> <span style="color: #000000; font-weight: bold;">then</span>
      lpstrDefExt <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066; font-weight: bold;">PChar</span><span style="color: #000066;">&#40;</span>DefaultExtension<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
&nbsp;
    Flags <span style="color: #000066;">:</span><span style="color: #000066;">=</span> Flags <span style="color: #000000; font-weight: bold;">or</span> DlgFlags<span style="color: #000066;">;</span>
  <span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">case</span> DlgType <span style="color: #000000; font-weight: bold;">of</span>
    VDT_OPENDIALOG<span style="color: #000066;">:</span>
      <span style="color: #000000; font-weight: bold;">if</span> GetOpenFileName<span style="color: #000066;">&#40;</span><span style="color: #000066;">@</span>fnStruct<span style="color: #000066;">&#41;</span> <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #000000; font-weight: bold;">begin</span>
        Result <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000000; font-weight: bold;">True</span><span style="color: #000066;">;</span>
        FileName <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066;">StrPas</span><span style="color: #000066;">&#40;</span>szFile<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
      <span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span>
    VDT_SAVEDIALOG<span style="color: #000066;">:</span>
      <span style="color: #000000; font-weight: bold;">if</span> GetSaveFileName<span style="color: #000066;">&#40;</span><span style="color: #000066;">@</span>fnStruct<span style="color: #000066;">&#41;</span> <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #000000; font-weight: bold;">begin</span>
        Result <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000000; font-weight: bold;">True</span><span style="color: #000066;">;</span>
        FileName <span style="color: #000066;">:</span><span style="color: #000066;">=</span> <span style="color: #000066;">StrPas</span><span style="color: #000066;">&#40;</span>szFile<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
      <span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span>
  <span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span>
<span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">;</span>
<span style="color: #000000; font-weight: bold;">end</span><span style="color: #000066;">.</span></pre></div>
<p>&nbsp;<br /><a href='http://www.dotfusion.net/wordpress/wp-content/uploads/2009/08/VistaOSDlg_Demo.zip'>Download Lazarus Compiled Demo Project with Source Code.</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.dotfusion.net/vista-compatible-open-and-save-dialog-in-lazarus-freepascal/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sub2Srt GUI in FreePascal (Lazarus)</title>
		<link>http://www.dotfusion.net/sub2srt_gui_in_freepascal_lazarus</link>
		<comments>http://www.dotfusion.net/sub2srt_gui_in_freepascal_lazarus#comments</comments>
		<pubDate>Thu, 23 Apr 2009 09:48:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Lazarus (FreePascal)]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[Free Tool]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Srt]]></category>
		<category><![CDATA[Sub]]></category>
		<category><![CDATA[Sub2Srt]]></category>
		<category><![CDATA[Win32]]></category>

		<guid isPermaLink="false">http://www.dotfusion.net/?p=131</guid>
		<description><![CDATA[I&#8217;ve been very busy lately, so I didn&#8217;t have much time to write almost anything. But these days (around Easter) I bought a WDTV Media Player for my television. And I found that the player didn&#8217;t play simple text subtitles (*.sub without *.idx). So I found this little script sub2srt.pl (Thanks Robelix) and I wrote [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been very busy lately, so I didn&#8217;t have much time to write almost anything.<br />
But these days (around Easter) I bought a WDTV Media Player for my television. And I found that the player didn&#8217;t play simple text subtitles (*.sub without *.idx). So I found this little script <a href="http://www.robelix.com/sub2srt/" target="_blank">sub2srt.pl</a> (Thanks Robelix) and I wrote a simple GUI for it in FreePascal so that it should compile on every platform.</p>
<p>&nbsp;</p>
<p><img src="http://www.dotfusion.net/wordpress/wp-content/uploads/2009/04/sub2srt_gui_win32_02-screenshot.png" alt="Sub2Srt GUI Win32 0.2 Screenshot" title="Sub2Srt GUI Win32 0.2 Screenshot" width="495" height="161" class="alignnone size-full wp-image-142" /></p>
<p>&nbsp;</p>
<p>I&#8217;m releasing the binary of the Win32 version for now. But stay tuned &#8211; soon I will be releasing a Win64 (AMD64) version, Linux (X86, AMD64) and MacOS X (Universal binary) versions of the program. And as soon as I&#8217;m sure the program works on all platforms I&#8217;ll release the the final source code.</p>
<p>&nbsp;</p>
<p><a href='http://www.dotfusion.net/wordpress/wp-content/uploads/2009/04/sub2srt_gui_win32_0.2.zip'>Download the 32-bit Windows version of Sub2Srt GUI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotfusion.net/sub2srt_gui_in_freepascal_lazarus/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running an Application as a Different User in C# and Masking password in Console</title>
		<link>http://www.dotfusion.net/running-app-as-different-user</link>
		<comments>http://www.dotfusion.net/running-app-as-different-user#comments</comments>
		<pubDate>Sun, 01 Feb 2009 18:53:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[C# Console Password Masking]]></category>
		<category><![CDATA[C# Example Code]]></category>
		<category><![CDATA[C# Running Application as Different User]]></category>
		<category><![CDATA[Free C# Source code]]></category>

		<guid isPermaLink="false">http://www.dotfusion.net/?p=101</guid>
		<description><![CDATA[Today I&#8217;ll show you not only one, but two interesting things.I&#8217;ll show you how to run an application from your C# program as a different user (for example Administrator). And I&#8217;ll also show you how to mask the password a user enters in your console application.&#160; A more illustrative primer of what I mean you [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ll show you not only one, but two interesting things.<br />I&#8217;ll show you how to run an application from your C# program as a different user (for example Administrator). And I&#8217;ll also show you how to mask the password a user enters in your console application.<br/>&nbsp;</p>
<p>A more illustrative primer of what I mean you can see on the screen captures below: </p>
<p>&nbsp;<br /><img src="http://www.dotfusion.net/wordpress/wp-content/uploads/2009/02/runasdiffuser-result.png" alt="Running a program as different user (Administrator) from C#" title="Running a program as different user (Administrator) from C#" width="238" height="33" class="alignnone size-full wp-image-109" /><br /> (running a program as Administrator from C#)<br />&nbsp;<br/><img src="http://www.dotfusion.net/wordpress/wp-content/uploads/2009/02/password-mask.png" alt="Password masking in C# console application." title="Password masking in C# console application." width="363" height="100" class="alignnone size-full wp-image-113" /><br/>(password mask in C# a program)</p>
<p>&nbsp;<br />
<strong>Source code:</strong></p>
<blockquote>

<div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Security</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.ComponentModel</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> RunAsDifferentUser
<span style="color: #008000;">&#123;</span>
    <span style="color: #6666cc; font-weight: bold;">class</span> Program
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">static</span> SecureString getSecureString<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">String</span> pass<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            SecureString password <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SecureString<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">Char</span> c <span style="color: #0600FF; font-weight: bold;">in</span> pass<span style="color: #008000;">&#41;</span>
                password<span style="color: #008000;">.</span><span style="color: #0000FF;">AppendChar</span><span style="color: #008000;">&#40;</span>c<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> password<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/* This function is to mask our 
         * password input in the console
         */</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> ReadPassword<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
            Stack<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&gt;</span> pass <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Stack<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span>ConsoleKeyInfo consKeyInfo <span style="color: #008000;">=</span> Console<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadKey</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
              consKeyInfo<span style="color: #008000;">.</span><span style="color: #0000FF;">Key</span> <span style="color: #008000;">!=</span> ConsoleKey<span style="color: #008000;">.</span><span style="color: #0000FF;">Enter</span><span style="color: #008000;">;</span> consKeyInfo <span style="color: #008000;">=</span> Console<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadKey</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>consKeyInfo<span style="color: #008000;">.</span><span style="color: #0000FF;">Key</span> <span style="color: #008000;">==</span> ConsoleKey<span style="color: #008000;">.</span><span style="color: #0000FF;">Backspace</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">try</span>
                    <span style="color: #008000;">&#123;</span>
                        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">SetCursorPosition</span><span style="color: #008000;">&#40;</span>Console<span style="color: #008000;">.</span><span style="color: #0000FF;">CursorLeft</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span>, Console<span style="color: #008000;">.</span><span style="color: #0000FF;">CursorTop</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot; &quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">SetCursorPosition</span><span style="color: #008000;">&#40;</span>Console<span style="color: #008000;">.</span><span style="color: #0000FF;">CursorLeft</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span>, Console<span style="color: #008000;">.</span><span style="color: #0000FF;">CursorTop</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                        pass<span style="color: #008000;">.</span><span style="color: #0000FF;">Pop</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span>
                    <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>InvalidOperationException ex<span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        <span style="color: #008080; font-style: italic;">/* Nothing to delete, go back to previous position */</span>
                        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">SetCursorPosition</span><span style="color: #008000;">&#40;</span>Console<span style="color: #008000;">.</span><span style="color: #0000FF;">CursorLeft</span> <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span>, Console<span style="color: #008000;">.</span><span style="color: #0000FF;">CursorTop</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #008000;">&#123;</span>
                    Console<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;*&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    pass<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>consKeyInfo<span style="color: #008000;">.</span><span style="color: #0000FF;">KeyChar</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> password <span style="color: #008000;">=</span> pass<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Array<span style="color: #008000;">.</span><span style="color: #0000FF;">Reverse</span><span style="color: #008000;">&#40;</span>password<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Join</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span>, password<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #6666cc; font-weight: bold;">String</span> domain <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">String</span> user <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Administrator&quot;</span><span style="color: #008000;">;</span>
&nbsp;
            Console<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Enter your administrator password: &quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            SecureString password <span style="color: #008000;">=</span> getSecureString<span style="color: #008000;">&#40;</span>ReadPassword<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #6666cc; font-weight: bold;">String</span> filename <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;regedit.exe&quot;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">try</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Process</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Start</span><span style="color: #008000;">&#40;</span>filename, user, password, domain<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\n</span>Our program is being succesfully run! Exiting.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>Win32Exception ex<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">Error</span><span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\n</span>{0}. Exiting.&quot;</span>, ex<span style="color: #008000;">.</span><span style="color: #0000FF;">Message</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div>
<p>&nbsp;<br /><a href='http://www.dotfusion.net/wordpress/wp-content/uploads/2009/02/runasdifferentuser.zip'>Download this Source Code (MS Visual C# 2005 Express Edition Project)</a></p></blockquote>
<p>Please note that if you want to try this example you have to know the Administrator password on your computer. If your administrator account is being renamed you&#8217;ll have to change the &#8220;user&#8221; string to the new name.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotfusion.net/running-app-as-different-user/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

