<?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"
	>

<channel>
	<title>Example Delphi</title>
	<atom:link href="http://exampledelphi.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://exampledelphi.com</link>
	<description>Delphi Examples Collection</description>
	<pubDate>Tue, 23 Feb 2010 22:11:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Change TDBGrid Row Height</title>
		<link>http://exampledelphi.com/delphi.php/tips-and-tricks/change-tdbgrid-row-height/</link>
		<comments>http://exampledelphi.com/delphi.php/tips-and-tricks/change-tdbgrid-row-height/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 22:11:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[VCL]]></category>

		<category><![CDATA[DBGrid]]></category>

		<category><![CDATA[height]]></category>

		<category><![CDATA[row]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=68</guid>
		<description><![CDATA[Examples that we will make here is about the TDBGrid Row height settings. If we want to change our DBGrid display by adding or reducing the high DBGrid row, can be done in the following ways:


To make this example we need a component TDBGrid, TButton and TEdit on Form1. Button1 will be used to trigger [...]]]></description>
			<content:encoded><![CDATA[<p><span id="result_box" class="long_text"><span style="background-color: #ffffff;" title="Contoh yang akan kita buat disini yaitu mengenai setting DBGrid Row height.">Examples that we will make here is about the <strong>TDBGrid Row height</strong> settings. </span><span style="background-color: #ffffff;" title="Jika kita ingin mengubah tampilan DBGrid kita dengan cara menambah atau mengurangi tinggi baris DBGrid, dapat dilakukan dengan cara berikut ini:">If we want to change our DBGrid display by adding or reducing the high <strong>DBGrid row</strong>, can be done in the following ways:<br />
</span></span></p>
<ol>
<li><span id="result_box" class="long_text"><span style="background-color: #ffffff;" title="Untuk membuat contoh ini kita memerlukan sebuah komponen TDBGrid, TButton dan TEdit pada Form1.">To make this example we need a component TDBGrid, TButton and TEdit on Form1. </span></span><span id="result_box" class="long_text"><span style="background-color: #ffffff;" title="Button1 akan kita gunakan untuk men-trigger perubahan tinggi baris DBGrid dengan Edit1 sebagai inputnya.">Button1 will be used to trigger changes to high DBGrid with Edit1 lines as input.</span></span></li>
<li><span id="result_box" class="long_text"><span title="Silahkan setting DBGrid agar terkoneksi dengan tabel dari database.">Please set DBGrid to connect with the tables from the database. </span><span style="background-color: #ffffff;" title="Pada contoh yang saya berikan saya menggunakan tabel Department dari database DEMODATA.">In the example I gave I use the table from the database DEMODATA Department.<br />
</span></span></li>
<li><span id="result_box" class="long_text"><span style="background-color: #ffffff;" title="Pada contoh yang saya berikan saya menggunakan tabel Department dari database DEMODATA.">Use this following code.<br />
</span></span></li>
</ol>
<p><span id="result_box" class="long_text"><span title="Berikut ini adalah kode sumbernya.">Here is the source code. </span><span title="Jika ingin men-download contoh kode sumbernya, silahkan klik disini">If you want to download the source code examples, please click <a href="http://www.enterupload.com/ovkspxwmlpjg/SetDBGridRowHeight.rar.html">Here</a></span></span><br />
<img src='http://serv2.enterupload.com/d2/i/00139/5vvfmgyipdnh.jpg' alt='Set DBGrid Row Height' class='alignnone' /></p>
<pre class="delphi"><span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids, DB, ADODB, ExtCtrls;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    ADOConnection1: TADOConnection;
    ADODataSet1: TADODataSet;
    Panel1: TPanel;
    Button1: TButton;
    Edit1: TEdit;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">procedure</span> FormCreate<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">private</span>
    <span style="color: #808080; font-style: italic;">{ Private declarations }</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #808080; font-style: italic;">{ Public declarations }</span>
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
  TMyDBGrid = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TDBGrid<span style="color: #66cc66;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #000000; font-weight: bold;">property</span> DefaultRowHeight;
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
  Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  DBGrid1.<span style="color: #006600;">DataSource</span>.<span style="color: #006600;">DataSet</span>.<span style="color: #006600;">DisableControls</span>;
  TStringGrid<span style="color: #66cc66;">&#40;</span>DBGrid1<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">DefaultRowHeight</span> := <span style="color: #000066;">StrToIntDef</span><span style="color: #66cc66;">&#40;</span>Edit1.<span style="color: #006600;">Text</span>,<span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
  DBGrid1.<span style="color: #006600;">DataSource</span>.<span style="color: #006600;">DataSet</span>.<span style="color: #006600;">EnableControls</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">FormCreate</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  DbGrid1.<span style="color: #006600;">Canvas</span>.<span style="color: #006600;">Font</span>.<span style="color: #006600;">Size</span> := <span style="color: #cc66cc;">13</span>;
  TMyDBGrid<span style="color: #66cc66;">&#40;</span>DBGrid1<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">DefaultRowHeight</span> := DBGrid1.<span style="color: #006600;">Canvas</span>.<span style="color: #006600;">TextHeight</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'MMMMM'</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;">4</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.
&nbsp;</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=68" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Related Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/mouse-scroll-within-dbgrid/" title="Mouse Scroll Within DBGrid">Mouse Scroll Within DBGrid</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/autosize-dbgrid/" title="Autosize DBGrid">Autosize DBGrid</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/tips-and-tricks/change-tdbgrid-row-height/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Delphi How to Get Computer Name</title>
		<link>http://exampledelphi.com/delphi.php/tips-and-tricks/delphi-how-to-get-computer-name/</link>
		<comments>http://exampledelphi.com/delphi.php/tips-and-tricks/delphi-how-to-get-computer-name/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 07:27:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[Windows API]]></category>

		<category><![CDATA[computer name]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=64</guid>
		<description><![CDATA[The title is explain what we want to do right now. Yes, this is a delphi example how we can get the windows computer name with delphi application. This simple application need a TButton and a TEdit component. When we click the button the computer name fill the edit box.

Here's the code:
unit Unit1;
&#160;
interface
&#160;
uses
  Windows, [...]]]></description>
			<content:encoded><![CDATA[<p>The title is explain what we want to do right now. Yes, this is a <strong>delphi example</strong> how we can <strong>get the windows computer name</strong> with delphi application. This simple application need a TButton and a TEdit component. When we click the button the computer name fill the edit box.<br />
<img src="http://img10.imageshack.us/img10/3164/getcomputername.jpg" alt="Delphi Get Computer Name" /><br />
Here's the code:</p>
<pre class="delphi"><span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
    Button1: TButton;
    Edit1: TEdit;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">private</span>
    <span style="color: #808080; font-style: italic;">{ Private declarations }</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #808080; font-style: italic;">{ Public declarations }</span>
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
  Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> GetComputerName: <span style="color: #993333;">string</span>;
<span style="color: #000000; font-weight: bold;">var</span>
  buffer: <span style="color: #000000; font-weight: bold;">array</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span>..<span style="color: #006600;">MAX_COMPUTERNAME_LENGTH</span> + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #000000; font-weight: bold;">of</span> <span style="color: #993333;">Char</span>;
  Size: <span style="color: #993333;">Cardinal</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  Size := MAX_COMPUTERNAME_LENGTH + <span style="color: #cc66cc;">1</span>;
  Windows.<span style="color: #006600;">GetComputerName</span><span style="color: #66cc66;">&#40;</span>@buffer, Size<span style="color: #66cc66;">&#41;</span>;
  Result := <span style="color: #000066;">StrPas</span><span style="color: #66cc66;">&#40;</span>buffer<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  Edit1.<span style="color: #006600;">Text</span> := GetComputerName;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.
&nbsp;</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=64" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Related Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/files/delete-a-directory/" title="Delete a Directory">Delete a Directory</a></li><li><a href="http://exampledelphi.com/delphi.php/windows-api/capture-desktop-screenshot-to-clipboard/" title="Capture Desktop Screenshot to Clipboard">Capture Desktop Screenshot to Clipboard</a></li><li><a href="http://exampledelphi.com/delphi.php/files/display-list-all-files-in-a-directory/" title="Display List All Files in a Directory">Display List All Files in a Directory</a></li><li><a href="http://exampledelphi.com/delphi.php/system/check-windows-nt-or-not/" title="Check Windows NT or Not">Check Windows NT or Not</a></li><li><a href="http://exampledelphi.com/delphi.php/system/display-the-win32-running-processes/" title="Display the Win32 Running Processes">Display the Win32 Running Processes</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/tips-and-tricks/delphi-how-to-get-computer-name/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Delphi How to Create DLL Contains a Form</title>
		<link>http://exampledelphi.com/delphi.php/tips-and-tricks/delphi-how-to-create-dll-contains-a-form/</link>
		<comments>http://exampledelphi.com/delphi.php/tips-and-tricks/delphi-how-to-create-dll-contains-a-form/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 03:47:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Form]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[dll]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=63</guid>
		<description><![CDATA[In this delphi example tutorial i want to show you how we can make a Dynamic Link Library (DLL) application that contain a form. So when we call a function declared in this DLL then it will show a form. In that case we need to create two project: a DLL project and a project [...]]]></description>
			<content:encoded><![CDATA[<p>In this <strong>delphi example tutorial</strong> i want to show you how we can make a <strong>Dynamic Link Library (DLL)</strong> application that <strong>contain a form</strong>. So when we call a function declared in this DLL then it will show a form. In that case we need to create two project: a <strong>DLL project</strong> and a project to <strong>call the DLL function or procedure</strong>.</p>
<p><strong>The DLL Project</strong></p>
<p>Creating a DLL file we can go using a <em>DLL Wizard</em> located at <em>File &gt; New &gt; Other</em> menus.<br />
<img src="http://img200.imageshack.us/img200/1933/dllwizard.jpg" alt="Delphi DLL Wizard" /><br />
Delphi the gives us a default DLL template like this:</p>
<pre class="delphi">library showformdll;
&nbsp;
<span style="color: #808080; font-style: italic;">{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  SysUtils,
  Classes,
  Unit1 <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">'Unit1.pas'</span> <span style="color: #808080; font-style: italic;">{Form1}</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.res}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">begin</span>
<span style="color: #000000; font-weight: bold;">end</span>.</pre>
<p>OK Let it like the original template first, know we need to create a form unit. Create a form unit from <em>File &gt; New &gt; Form</em> Menus. Now we have Project1 with Unit1.<br />
Ok now back to the project1. Add this code below to create a procedure to open Form1 in unit1 then Export the procedure.</p>
<pre class="delphi">library showformdll;
&nbsp;
<span style="color: #808080; font-style: italic;">{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  SysUtils,
  Classes,
  Unit1 <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">'Unit1.pas'</span> <span style="color: #808080; font-style: italic;">{Form1}</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.res}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">Procedure</span> ShowForm<span style="color: #66cc66;">&#40;</span>Atitle:<span style="color: #993333;">String</span><span style="color: #66cc66;">&#41;</span>;stdcall;
<span style="color: #000000; font-weight: bold;">begin</span>
  form1 := TForm1.<span style="color: #006600;">Create</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">nil</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">try</span>
    form1.<span style="color: #006600;">Caption</span> := Atitle;
    Form1.<span style="color: #006600;">ShowModal</span>;
  <span style="color: #000000; font-weight: bold;">except</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">end</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
Exports
  ShowForm;
&nbsp;
<span style="color: #000000; font-weight: bold;">begin</span>
<span style="color: #000000; font-weight: bold;">end</span>.</pre>
<p>ShowForm procedure is a procedure to open Form1. Save the project as "showformdll" than compile it. This will produce "showformdll.dll".</p>
<p><strong>The Caller</strong><br />
After create the DLL than we need to create a small application to call ShowForm procedure declared in showformdll. Just create a simple application from <em>File &gt; New &gt; Application</em> menus then put a button to call the procedure.<br />
<img src="http://img200.imageshack.us/img200/107/dllcaller.jpg" alt="DLL Caller Application" /><br />
Code is as simply like this:</p>
<pre class="delphi"><span style="color: #000000; font-weight: bold;">Procedure</span> ShowForm<span style="color: #66cc66;">&#40;</span>Atitle:<span style="color: #993333;">string</span><span style="color: #66cc66;">&#41;</span>;stdcall;external <span style="color: #ff0000;">'showformdll.DLL'</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
   ShowForm<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'This is a Form in DLL'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;</pre>
<p>Save this project as "DLLCaller" for example then it will create "DLLCaller.exe" when compiled. Now you can test your application. When Show Form button clicked, then we will see this form.<br />
<img src="http://img200.imageshack.us/img200/9995/formindll.jpg" alt="Form in DLL" /></p>
<p>You can download the delphi example code here:http://www.mediafire.com/file/tkqdbtanl5z/dll-form.rar</p>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=63" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Related Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/splash-screen-when-application-initialized/" title="Splash Screen When Application Initialized">Splash Screen When Application Initialized</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/use-system-tray-icon/" title="Use System Tray Icon">Use System Tray Icon</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/how-to-make-desktop-center-form/" title="How to Make Desktop Center Form">How to Make Desktop Center Form</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/hide-the-forms-caption-bar/" title="Hide The Form&#8217;s Caption Bar">Hide The Form&#8217;s Caption Bar</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/check-if-application-already-open/" title="Check If Application Already Open">Check If Application Already Open</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/tips-and-tricks/delphi-how-to-create-dll-contains-a-form/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zoom a Stringgrid</title>
		<link>http://exampledelphi.com/delphi.php/tips-and-tricks/zoom-a-stringgrid/</link>
		<comments>http://exampledelphi.com/delphi.php/tips-and-tricks/zoom-a-stringgrid/#comments</comments>
		<pubDate>Wed, 27 May 2009 06:01:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[VCL]]></category>

		<category><![CDATA[StringGrid]]></category>

		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=62</guid>
		<description><![CDATA[In this delphi example tutorial we will make an application contain a Stringgrid (TStringgrid) and two Button (TButton). The Stringgrid will be enable for zooming in and zooming out. Firt button will execute a procedure for Zoom In and the other one will execute Zoom Out Procedure. Here the screenshot:

And this is the code:
unit Unit1;
&#160;
interface
&#160;
uses
 [...]]]></description>
			<content:encoded><![CDATA[<p>In this <strong>delphi example tutorial</strong> we will make an application contain a <strong>Stringgrid</strong> (TStringgrid) and two Button (TButton). The Stringgrid will be enable for zooming in and zooming out. Firt button will execute a procedure for <strong>Zoom In</strong> and the other one will execute <strong>Zoom Out</strong> Procedure. Here the screenshot:<br />
<img src='http://img211.imageshack.us/img211/1986/stringgridzoom.jpg' alt='Delphi Zoom a Stringgrid' class='alignnone' /><br />
And this is the code:</p>
<pre class="delphi"><span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, StdCtrls;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
    StringGrid1: TStringGrid;
    Button1: TButton;
    Button2: TButton;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button2Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">private</span>
    <span style="color: #808080; font-style: italic;">{ Private declarations }</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #808080; font-style: italic;">{ Public declarations }</span>
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
  Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> ZoomGrid<span style="color: #66cc66;">&#40;</span>AStringgrid:TStringGrid;level:<span style="color: #993333;">Real</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span>
  i:<span style="color: #993333;">integer</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  <span style="color: #000000; font-weight: bold;">for</span> i := <span style="color: #cc66cc;">0</span> <span style="color: #000000; font-weight: bold;">to</span> AStringgrid.<span style="color: #006600;">colcount</span> - <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">do</span>
    AStringgrid.<span style="color: #006600;">colwidths</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> := <span style="color: #000066;">round</span><span style="color: #66cc66;">&#40;</span>AStringgrid.<span style="color: #006600;">colwidths</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> * level<span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">for</span> i := <span style="color: #cc66cc;">0</span> <span style="color: #000000; font-weight: bold;">to</span> AStringgrid.<span style="color: #006600;">RowCount</span> - <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">do</span>
    AStringgrid.<span style="color: #006600;">rowheights</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> := <span style="color: #000066;">round</span><span style="color: #66cc66;">&#40;</span>AStringgrid.<span style="color: #006600;">rowheights</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> * level<span style="color: #66cc66;">&#41;</span>;
&nbsp;
  AStringgrid.<span style="color: #006600;">Font</span>.<span style="color: #006600;">Size</span> := <span style="color: #000066;">round</span><span style="color: #66cc66;">&#40;</span>AStringgrid.<span style="color: #006600;">rowheights</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> * <span style="color: #cc66cc;">0.65</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  ZoomGrid<span style="color: #66cc66;">&#40;</span>StringGrid1,<span style="color: #cc66cc;">1.1</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button2Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  ZoomGrid<span style="color: #66cc66;">&#40;</span>StringGrid1,<span style="color: #cc66cc;">0.9</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=62" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Related Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/copy-stringgrid-cells-content-to-a-memo/" title="Copy Stringgrid Cell&#8217;s Content to a Memo">Copy Stringgrid Cell&#8217;s Content to a Memo</a></li><li><a href="http://exampledelphi.com/delphi.php/files/export-text-file-to-excel-file/" title="Export Text File to Excel File">Export Text File to Excel File</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/delete-row-in-tstringgrid-component/" title="Delete Row in TStringGrid Component">Delete Row in TStringGrid Component</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/tips-and-tricks/zoom-a-stringgrid/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Copy Stringgrid Cell&#8217;s Content to a Memo</title>
		<link>http://exampledelphi.com/delphi.php/tips-and-tricks/copy-stringgrid-cells-content-to-a-memo/</link>
		<comments>http://exampledelphi.com/delphi.php/tips-and-tricks/copy-stringgrid-cells-content-to-a-memo/#comments</comments>
		<pubDate>Wed, 27 May 2009 01:58:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[Copy]]></category>

		<category><![CDATA[Memo]]></category>

		<category><![CDATA[String]]></category>

		<category><![CDATA[StringGrid]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=61</guid>
		<description><![CDATA[In this Delphi example we will make a simple application where it contain a Stringgrid (TStringGrid), a Button (TButton) and a Memo (TMemo). Button "Copy" used to copy a text string from selection cell in stringgrid. Below is the screenshot fo this application:

and this is the code:
unit Unit1;
&#160;
interface
&#160;
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, [...]]]></description>
			<content:encoded><![CDATA[<p>In this Delphi example we will make a simple application where it contain a Stringgrid (TStringGrid), a Button (TButton) and a Memo (TMemo). Button "Copy" used to copy a text string from selection cell in stringgrid. Below is the screenshot fo this application:<br />
<img src="http://img27.imageshack.us/img27/8027/stringgridtomemo.jpg" alt="Delphi Copy Stringgrid to Memo" /><br />
and this is the code:</p>
<pre class="delphi"><span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
StringGrid1: TStringGrid;
Memo1: TMemo;
Button1: TButton;
<span style="color: #000000; font-weight: bold;">procedure</span> Button1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">private</span>
<span style="color: #808080; font-style: italic;">{ Private declarations }</span>
<span style="color: #000000; font-weight: bold;">public</span>
<span style="color: #808080; font-style: italic;">{ Public declarations }</span>
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span>
str_from_grid:<span style="color: #993333;">string</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
str_from_grid := StringGrid1.<span style="color: #006600;">Cells</span><span style="color: #66cc66;">&#91;</span>StringGrid1.<span style="color: #006600;">Col</span>,StringGrid1.<span style="color: #006600;">Row</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000066;">Length</span><span style="color: #66cc66;">&#40;</span>str_from_grid<span style="color: #66cc66;">&#41;</span> &amp;gt; <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">then</span>
Memo1.<span style="color: #006600;">Lines</span>.<span style="color: #006600;">Add</span><span style="color: #66cc66;">&#40;</span>str_from_grid<span style="color: #66cc66;">&#41;</span> ;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=61" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Related Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/zoom-a-stringgrid/" title="Zoom a Stringgrid">Zoom a Stringgrid</a></li><li><a href="http://exampledelphi.com/delphi.php/files/export-text-file-to-excel-file/" title="Export Text File to Excel File">Export Text File to Excel File</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/delete-row-in-tstringgrid-component/" title="Delete Row in TStringGrid Component">Delete Row in TStringGrid Component</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/how-to-get-current-memo-line-number/" title="How to Get Current Memo Line Number">How to Get Current Memo Line Number</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/parsing-the-string-or-text/" title="Parsing the String or Text">Parsing the String or Text</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/tips-and-tricks/copy-stringgrid-cells-content-to-a-memo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Take a Property Value From Many Object with As Operator</title>
		<link>http://exampledelphi.com/delphi.php/tips-and-tricks/take-a-property-value-from-many-object-with-as-operator/</link>
		<comments>http://exampledelphi.com/delphi.php/tips-and-tricks/take-a-property-value-from-many-object-with-as-operator/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 10:53:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[As]]></category>

		<category><![CDATA[RadioButton]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=45</guid>
		<description><![CDATA[&#160;
//This is how we can Take a property value from many Object with As Operator
// Form this example we need 5 RadioButton1 to RadioButton5(TRadioButton) placed on Form1
//The we make GetRadioButtonCaption Function to be called by clicking each of RadioButton
//On Click event of each TRadioButton call this GetRadioButtonCaption Function
&#160;
unit Unit1;
&#160;
interface
&#160;
uses
  Windows, Messages, SysUtils, Variants, Classes, [...]]]></description>
			<content:encoded><![CDATA[<pre class="delphi">&nbsp;
<span style="color: #808080; font-style: italic;">//This is how we can Take a property value from many Object with As Operator</span>
<span style="color: #808080; font-style: italic;">// Form this example we need 5 RadioButton1 to RadioButton5(TRadioButton) placed on Form1</span>
<span style="color: #808080; font-style: italic;">//The we make GetRadioButtonCaption Function to be called by clicking each of RadioButton</span>
<span style="color: #808080; font-style: italic;">//On Click event of each TRadioButton call this GetRadioButtonCaption Function</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    <span style="color: #000000; font-weight: bold;">procedure</span> RadioButton1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">procedure</span> RadioButton2Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">procedure</span> RadioButton3Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">procedure</span> RadioButton4Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">procedure</span> RadioButton5Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">private</span>
    <span style="color: #808080; font-style: italic;">{ Private declarations }</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #808080; font-style: italic;">{ Public declarations }</span>
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
  Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> GetRadioButtonCaption<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #993333;">String</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  Result :=<span style="color: #66cc66;">&#40;</span>Sender <span style="color: #000000; font-weight: bold;">as</span> TRadioButton<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">Caption</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">RadioButton1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  Showmessage<span style="color: #66cc66;">&#40;</span>GetRadioButtonCaption<span style="color: #66cc66;">&#40;</span>Sender<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">RadioButton2Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
 Showmessage<span style="color: #66cc66;">&#40;</span>GetRadioButtonCaption<span style="color: #66cc66;">&#40;</span>Sender<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">RadioButton3Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  Showmessage<span style="color: #66cc66;">&#40;</span>GetRadioButtonCaption<span style="color: #66cc66;">&#40;</span>Sender<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">RadioButton4Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  Showmessage<span style="color: #66cc66;">&#40;</span>GetRadioButtonCaption<span style="color: #66cc66;">&#40;</span>Sender<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">RadioButton5Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  Showmessage<span style="color: #66cc66;">&#40;</span>GetRadioButtonCaption<span style="color: #66cc66;">&#40;</span>Sender<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.
&nbsp;</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=45" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Other Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/files/how-to-insert-files-content-to-a-memo/" title="How to Insert File&#8217;s Content to a Memo">How to Insert File&#8217;s Content to a Memo</a></li><li><a href="http://exampledelphi.com/delphi.php/socket/get-image-from-server-with-indy-socket/" title="Get Image from Server with Indy Socket">Get Image from Server with Indy Socket</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/open-a-password-protected-access-database-with-topendialog/" title="Open A Password Protected Access Database with TOpenDialog">Open A Password Protected Access Database with TOpenDialog</a></li><li><a href="http://exampledelphi.com/delphi.php/files/search-file-in-a-directory-and-perform-result-in-tlistbox/" title="Search File in A Directory and Perform Result in TListBox">Search File in A Directory and Perform Result in TListBox</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/crop-image-with-drag-the-mouse/" title="Crop Image with Drag the Mouse">Crop Image with Drag the Mouse</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/tips-and-tricks/take-a-property-value-from-many-object-with-as-operator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Open A Password Protected Access Database with TOpenDialog</title>
		<link>http://exampledelphi.com/delphi.php/tips-and-tricks/open-a-password-protected-access-database-with-topendialog/</link>
		<comments>http://exampledelphi.com/delphi.php/tips-and-tricks/open-a-password-protected-access-database-with-topendialog/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 03:34:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[Access]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=43</guid>
		<description><![CDATA[//This is how we can open a password protected access database with TOpenDialog
//For this example we need Button1 and Button2 (TButton), Edit1 and Edit2 (TEdit) and also AdoConnection1 (TAdoConnection)
//Button1 is used to open access database file
//Edit2 is used for access database password
//Button2 is used to open connection
&#160;
unit Unit1;
&#160;
interface
&#160;
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, [...]]]></description>
			<content:encoded><![CDATA[<pre class="delphi"><span style="color: #808080; font-style: italic;">//This is how we can open a password protected access database with TOpenDialog</span>
<span style="color: #808080; font-style: italic;">//For this example we need Button1 and Button2 (TButton), Edit1 and Edit2 (TEdit) and also AdoConnection1 (TAdoConnection)</span>
<span style="color: #808080; font-style: italic;">//Button1 is used to open access database file</span>
<span style="color: #808080; font-style: italic;">//Edit2 is used for access database password</span>
<span style="color: #808080; font-style: italic;">//Button2 is used to open connection</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
    Button1: TButton;
    Edit1: TEdit;
    ADOConnection1: TADOConnection;
    Edit2: TEdit;
    OpenDialog1: TOpenDialog;
    Button2: TButton;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button2Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">private</span>
    <span style="color: #808080; font-style: italic;">{ Private declarations }</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #808080; font-style: italic;">{ Public declarations }</span>
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
  Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  <span style="color: #000000; font-weight: bold;">if</span> OpenDialog1.<span style="color: #006600;">Execute</span> <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #000000; font-weight: bold;">begin</span>
    Edit1.<span style="color: #006600;">Text</span> := OpenDialog1.<span style="color: #006600;">FileName</span>;
  <span style="color: #000000; font-weight: bold;">end</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button2Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
    ADOConnection1.<span style="color: #000066;">Close</span>;
    ADOConnection1.<span style="color: #006600;">ConnectionString</span> := <span style="color: #ff0000;">'Provider=Microsoft.Jet.OLEDB.4.0;Data '</span> +
      <span style="color: #ff0000;">'Source='</span>+Edit1.<span style="color: #006600;">Text</span>+<span style="color: #ff0000;">';Mode=ReadWrite;Persist '</span> +
      <span style="color: #ff0000;">'Security Info=False;Jet OLEDB:Database Password='</span>+Edit2.<span style="color: #006600;">Text</span>;
    Edit1.<span style="color: #006600;">Text</span> := OpenDialog1.<span style="color: #006600;">FileName</span>;
    <span style="color: #000000; font-weight: bold;">try</span>
      ADOConnection1.<span style="color: #006600;">Open</span>;
      <span style="color: #000000; font-weight: bold;">if</span> ADOConnection1.<span style="color: #006600;">Connected</span> = <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #000000; font-weight: bold;">then</span>
        showmessage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Connected Sccessfull to '</span>+Edit1.<span style="color: #006600;">Text</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">except</span>
      showmessage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Connection to '</span>+Edit1.<span style="color: #006600;">Text</span>+<span style="color: #ff0000;">' failed'</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">end</span>
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.
&nbsp;</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=43" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Related Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/compact-and-repair-access-database/" title="Compact and Repair Access Database">Compact and Repair Access Database</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/mouse-scroll-within-dbgrid/" title="Mouse Scroll Within DBGrid">Mouse Scroll Within DBGrid</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/autosize-dbgrid/" title="Autosize DBGrid">Autosize DBGrid</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/fill-the-combobox-items-from-dataset/" title="Fill the Combobox Items from Dataset">Fill the Combobox Items from Dataset</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/tips-and-tricks/open-a-password-protected-access-database-with-topendialog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bitmap Operation for JPEG or JPG Image</title>
		<link>http://exampledelphi.com/delphi.php/files/bitmap-operation-for-jpeg-or-jpg-image/</link>
		<comments>http://exampledelphi.com/delphi.php/files/bitmap-operation-for-jpeg-or-jpg-image/#comments</comments>
		<pubDate>Mon, 12 May 2008 06:51:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Files]]></category>

		<category><![CDATA[Graphic]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[Bitmap]]></category>

		<category><![CDATA[Image]]></category>

		<category><![CDATA[JPEG]]></category>

		<category><![CDATA[JPG]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=42</guid>
		<description><![CDATA[//This is how we can operate any Bitmap Operation to our JPEG image
//To make a bitmap operation in JPEG Image, first we need to convert JPEG Image to bitmap
//Then run any bitmap operation on convert result bitmap
//Then assign JPEG result from operated bitmap
//For this example we use convert to grayscale bitmap operation
//Use Button1(TButton) and OpenDialog1(TOpenDialog) [...]]]></description>
			<content:encoded><![CDATA[<pre class="delphi"><span style="color: #808080; font-style: italic;">//This is how we can operate any Bitmap Operation to our JPEG image</span>
<span style="color: #808080; font-style: italic;">//To make a bitmap operation in JPEG Image, first we need to convert JPEG Image to bitmap</span>
<span style="color: #808080; font-style: italic;">//Then run any bitmap operation on convert result bitmap</span>
<span style="color: #808080; font-style: italic;">//Then assign JPEG result from operated bitmap</span>
<span style="color: #808080; font-style: italic;">//For this example we use convert to grayscale bitmap operation</span>
<span style="color: #808080; font-style: italic;">//Use Button1(TButton) and OpenDialog1(TOpenDialog) for this example</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">private</span>
    <span style="color: #808080; font-style: italic;">{ Private declarations }</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #808080; font-style: italic;">{ Public declarations }</span>
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
  Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  jpeg;
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> ConvertBitmapToGrayscale<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">const</span> Bitmap: TBitmap<span style="color: #66cc66;">&#41;</span>: TBitmap;
<span style="color: #000000; font-weight: bold;">var</span>
  i, j: <span style="color: #993333;">Integer</span>;
  Grayshade, Red, Green, Blue: <span style="color: #993333;">Byte</span>;
  PixelColor: <span style="color: #993333;">Longint</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  <span style="color: #000000; font-weight: bold;">with</span> Bitmap <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">for</span> i := <span style="color: #cc66cc;">0</span> <span style="color: #000000; font-weight: bold;">to</span> Width - <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">do</span>
      <span style="color: #000000; font-weight: bold;">for</span> j := <span style="color: #cc66cc;">0</span> <span style="color: #000000; font-weight: bold;">to</span> Height - <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">do</span>
      <span style="color: #000000; font-weight: bold;">begin</span>
        PixelColor := ColorToRGB<span style="color: #66cc66;">&#40;</span>Canvas.<span style="color: #006600;">Pixels</span><span style="color: #66cc66;">&#91;</span>i, j<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
        Red        := PixelColor;
        Green      := PixelColor <span style="color: #000000; font-weight: bold;">shr</span> <span style="color: #cc66cc;">8</span>;
        Blue       := PixelColor <span style="color: #000000; font-weight: bold;">shr</span> <span style="color: #cc66cc;">16</span>;
        Grayshade  := <span style="color: #000066;">Round</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.3</span> * Red + <span style="color: #cc66cc;">0.6</span> * Green + <span style="color: #cc66cc;">0.1</span> * Blue<span style="color: #66cc66;">&#41;</span>;
        Canvas.<span style="color: #006600;">Pixels</span><span style="color: #66cc66;">&#91;</span>i, j<span style="color: #66cc66;">&#93;</span> := RGB<span style="color: #66cc66;">&#40;</span>Grayshade, Grayshade, Grayshade<span style="color: #66cc66;">&#41;</span>;
      <span style="color: #000000; font-weight: bold;">end</span>;
  Result := Bitmap;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> ConvertToBitmap<span style="color: #66cc66;">&#40;</span>Source : TGraphic; Bitmap : TBitmap<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
 <span style="color: #000000; font-weight: bold;">try</span>
  <span style="color: #000000; font-weight: bold;">if</span> Bitmap = <span style="color: #000000; font-weight: bold;">nil</span> <span style="color: #000000; font-weight: bold;">then</span>
    Bitmap := TBitmap.<span style="color: #006600;">Create</span>
  <span style="color: #000000; font-weight: bold;">else</span> Bitmap.<span style="color: #006600;">FreeImage</span>;
  Bitmap.<span style="color: #006600;">Width</span> := Source.<span style="color: #006600;">Width</span>;
  Bitmap.<span style="color: #006600;">Height</span> := Source.<span style="color: #006600;">Height</span>;
  Bitmap.<span style="color: #006600;">Canvas</span>.<span style="color: #006600;">Draw</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,Source<span style="color: #66cc66;">&#41;</span>;
 <span style="color: #000000; font-weight: bold;">except</span>
   showmessage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'No Loaded File'</span><span style="color: #66cc66;">&#41;</span>;
 <span style="color: #000000; font-weight: bold;">end</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span>
  MyJpeg,OperatedJpeg:TJPEGImage;
  MyBitmap,OperatedBitmap:TBitmap;
<span style="color: #000000; font-weight: bold;">begin</span>
  <span style="color: #000000; font-weight: bold;">if</span> OpenDialog1.<span style="color: #006600;">Execute</span> <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #000000; font-weight: bold;">begin</span>
    MyJpeg        := TJPEGImage.<span style="color: #006600;">Create</span>;
    MyBitmap      := TBitmap.<span style="color: #006600;">Create</span>;
    OperatedBitmap := TBitmap.<span style="color: #006600;">Create</span>;
    OperatedJpeg   :=  TJPEGImage.<span style="color: #006600;">Create</span>;
    <span style="color: #000000; font-weight: bold;">try</span>
      MyJpeg.<span style="color: #006600;">LoadFromFile</span><span style="color: #66cc66;">&#40;</span>OpenDialog1.<span style="color: #006600;">FileName</span><span style="color: #66cc66;">&#41;</span>;
      ConvertToBitmap<span style="color: #66cc66;">&#40;</span>MyJpeg,MyBitmap<span style="color: #66cc66;">&#41;</span>;
      <span style="color: #808080; font-style: italic;">// Do any Bitmap Operation Here</span>
      <span style="color: #808080; font-style: italic;">//For Example i Convert Bitmap To GrayScale and perform result into</span>
      <span style="color: #808080; font-style: italic;">//operateBitmap</span>
      OperatedBitmap := ConvertBitmapToGrayscale<span style="color: #66cc66;">&#40;</span>MyBitmap<span style="color: #66cc66;">&#41;</span>;
      <span style="color: #808080; font-style: italic;">//Perform operated bitmap into jpeg</span>
      OperatedJpeg.<span style="color: #006600;">Assign</span><span style="color: #66cc66;">&#40;</span>OperatedBitmap<span style="color: #66cc66;">&#41;</span>;
      OperatedJpeg.<span style="color: #006600;">SaveToFile</span><span style="color: #66cc66;">&#40;</span>OpenDialog1.<span style="color: #006600;">FileName</span>+<span style="color: #ff0000;">'-Gray.jpeg'</span><span style="color: #66cc66;">&#41;</span>;
      Showmessage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Operation Completed'</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">finally</span>
      MyJpeg.<span style="color: #006600;">Free</span>;
      OperatedJpeg.<span style="color: #006600;">Free</span>;
    <span style="color: #000000; font-weight: bold;">end</span>;
  <span style="color: #000000; font-weight: bold;">end</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=42" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Related Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/crop-image-with-drag-the-mouse/" title="Crop Image with Drag the Mouse">Crop Image with Drag the Mouse</a></li><li><a href="http://exampledelphi.com/delphi.php/graphic/rotate-bitmap/" title="Rotate Bitmap">Rotate Bitmap</a></li><li><a href="http://exampledelphi.com/delphi.php/graphic/convert-bitmap-image-to-grayscale/" title="Convert Bitmap Image to Grayscale">Convert Bitmap Image to Grayscale</a></li><li><a href="http://exampledelphi.com/delphi.php/windows-api/capture-desktop-screenshot-to-clipboard/" title="Capture Desktop Screenshot to Clipboard">Capture Desktop Screenshot to Clipboard</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/files/bitmap-operation-for-jpeg-or-jpg-image/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Play a Wav Sound Without TMediaPlayer</title>
		<link>http://exampledelphi.com/delphi.php/tips-and-tricks/play-a-wav-sound-without-tmediaplayer/</link>
		<comments>http://exampledelphi.com/delphi.php/tips-and-tricks/play-a-wav-sound-without-tmediaplayer/#comments</comments>
		<pubDate>Wed, 07 May 2008 09:51:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Multimedia]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[Sound]]></category>

		<category><![CDATA[Wav]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=41</guid>
		<description><![CDATA[//This is we can play a WAV file without TMediaPlayer Component
//Using PlaySound Function declared in mmsystem unit
//So you must add mmsystem in uses clause
&#160;
unit Unit1;
&#160;
interface
&#160;
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, MPlayer, StdCtrls;
&#160;
type
  TForm1 = class&#40;TForm&#41;
    Button1: TButton;
    procedure Button1Click&#40;Sender: TObject&#41;;
  [...]]]></description>
			<content:encoded><![CDATA[<pre class="delphi"><span style="color: #808080; font-style: italic;">//This is we can play a WAV file without TMediaPlayer Component</span>
<span style="color: #808080; font-style: italic;">//Using PlaySound Function declared in mmsystem unit</span>
<span style="color: #808080; font-style: italic;">//So you must add mmsystem in uses clause</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, MPlayer, StdCtrls;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
    Button1: TButton;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">private</span>
    <span style="color: #808080; font-style: italic;">{ Private declarations }</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #808080; font-style: italic;">{ Public declarations }</span>
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
  Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  mmsystem;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
   PlaySound<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">PChar</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'C:\WINDOWS\Media\Windows XP Startup.wav'</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">0</span>,SND_ASYNC<span style="color: #66cc66;">&#41;</span>
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.
&nbsp;</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=41" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Other Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/system/display-the-win32-running-processes/" title="Display the Win32 Running Processes">Display the Win32 Running Processes</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/fill-the-combobox-items-from-dataset/" title="Fill the Combobox Items from Dataset">Fill the Combobox Items from Dataset</a></li><li><a href="http://exampledelphi.com/delphi.php/graphic/convert-bitmap-image-to-grayscale/" title="Convert Bitmap Image to Grayscale">Convert Bitmap Image to Grayscale</a></li><li><a href="http://exampledelphi.com/delphi.php/system/check-windows-nt-or-not/" title="Check Windows NT or Not">Check Windows NT or Not</a></li><li><a href="http://exampledelphi.com/delphi.php/system/accept-the-dropped-files-from-windows-explorer/" title="Accept the Dropped Files From Windows Explorer">Accept the Dropped Files From Windows Explorer</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/tips-and-tricks/play-a-wav-sound-without-tmediaplayer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Delete a Directory</title>
		<link>http://exampledelphi.com/delphi.php/files/delete-a-directory/</link>
		<comments>http://exampledelphi.com/delphi.php/files/delete-a-directory/#comments</comments>
		<pubDate>Tue, 06 May 2008 11:52:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Files]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[Windows API]]></category>

		<category><![CDATA[Directory]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://exampledelphi.com/?p=40</guid>
		<description><![CDATA[//This is how we can delete a directory
//DelDir Function originally wrote by Rainer Kümmerle (http://www.thinklazy.de)
//Put a Button1(Tbutton) then use this code
//Make a directory named 'DeletedDir' in your application path to be tested
&#160;
unit Unit1;
&#160;
interface
&#160;
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
&#160;
type
  TForm1 = class&#40;TForm&#41;
    Button1: TButton;
  [...]]]></description>
			<content:encoded><![CDATA[<pre class="delphi"><span style="color: #808080; font-style: italic;">//This is how we can delete a directory</span>
<span style="color: #808080; font-style: italic;">//DelDir Function originally wrote by Rainer Kümmerle (http://www.thinklazy.de)</span>
<span style="color: #808080; font-style: italic;">//Put a Button1(Tbutton) then use this code</span>
<span style="color: #808080; font-style: italic;">//Make a directory named 'DeletedDir' in your application path to be tested</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">unit</span> Unit1;
&nbsp;
<span style="color: #000000; font-weight: bold;">interface</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
&nbsp;
<span style="color: #000000; font-weight: bold;">type</span>
  TForm1 = <span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#40;</span>TForm<span style="color: #66cc66;">&#41;</span>
    Button1: TButton;
    <span style="color: #000000; font-weight: bold;">procedure</span> Button1Click<span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">private</span>
    <span style="color: #808080; font-style: italic;">{ Private declarations }</span>
  <span style="color: #000000; font-weight: bold;">public</span>
    <span style="color: #808080; font-style: italic;">{ Public declarations }</span>
  <span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span>
  Form1: TForm1;
&nbsp;
<span style="color: #000000; font-weight: bold;">implementation</span>
&nbsp;
<span style="color: #808080; font-style: italic;">{$R *.dfm}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">uses</span>
  ShellApi;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> DelDir<span style="color: #66cc66;">&#40;</span>dir: <span style="color: #993333;">string</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #993333;">Boolean</span>;
<span style="color: #000000; font-weight: bold;">var</span>
  fos: TSHFileOpStruct;
<span style="color: #000000; font-weight: bold;">begin</span>
  ZeroMemory<span style="color: #66cc66;">&#40;</span>@fos, <span style="color: #000066;">SizeOf</span><span style="color: #66cc66;">&#40;</span>fos<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">with</span> fos <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #000000; font-weight: bold;">begin</span>
    wFunc  := FO_DELETE;
    fFlags := FOF_SILENT <span style="color: #000000; font-weight: bold;">or</span> FOF_NOCONFIRMATION;
    pFrom  := <span style="color: #993333;">PChar</span><span style="color: #66cc66;">&#40;</span>dir + <span style="color: #ff0000;">#<span style="color: #cc66cc;">0</span></span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">end</span>;
  Result := <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span> = ShFileOperation<span style="color: #66cc66;">&#40;</span>fos<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">procedure</span> TForm1.<span style="color: #006600;">Button1Click</span><span style="color: #66cc66;">&#40;</span>Sender: <span style="color: #993333;">TObject</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">begin</span>
  ShowMessage<span style="color: #66cc66;">&#40;</span><span style="color: #000066;">ExtractFilePath</span><span style="color: #66cc66;">&#40;</span>Application.<span style="color: #006600;">ExeName</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #ff0000;">'DeletedDir'</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">if</span> DelDir<span style="color: #66cc66;">&#40;</span><span style="color: #000066;">ExtractFilePath</span><span style="color: #66cc66;">&#40;</span>Application.<span style="color: #006600;">ExeName</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #ff0000;">'DeletedDir'</span><span style="color: #66cc66;">&#41;</span>=<span style="color: #000000; font-weight: bold;">true</span> <span style="color: #000000; font-weight: bold;">then</span>
    ShowMessage<span style="color: #66cc66;">&#40;</span><span style="color: #000066;">ExtractFilePath</span><span style="color: #66cc66;">&#40;</span>Application.<span style="color: #006600;">ExeName</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #ff0000;">'DeletedDir'</span>+<span style="color: #ff0000;">' '</span> +
      <span style="color: #ff0000;">'succesfully deleted'</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    ShowMessage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Delete Failed'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">end</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">end</span>.
&nbsp;</pre>
 <span class="post2pdf_span" ><a href="http://exampledelphi.com/wp-content/plugins/post2pdf/generate.php?post=40" rel="nofollow"><img src="http://exampledelphi.com/wp-content/plugins/post2pdf/icon/pdf.png" width="18px" height="16px" /></a></span><h2>Related Examples</h2><ul class="related_post"><li><a href="http://exampledelphi.com/delphi.php/files/display-list-all-files-in-a-directory/" title="Display List All Files in a Directory">Display List All Files in a Directory</a></li><li><a href="http://exampledelphi.com/delphi.php/tips-and-tricks/delphi-how-to-get-computer-name/" title="Delphi How to Get Computer Name">Delphi How to Get Computer Name</a></li><li><a href="http://exampledelphi.com/delphi.php/files/export-text-file-to-excel-file/" title="Export Text File to Excel File">Export Text File to Excel File</a></li><li><a href="http://exampledelphi.com/delphi.php/files/export-excel-file-to-text-file/" title="Export Excel File to Text File">Export Excel File to Text File</a></li><li><a href="http://exampledelphi.com/delphi.php/windows-api/capture-desktop-screenshot-to-clipboard/" title="Capture Desktop Screenshot to Clipboard">Capture Desktop Screenshot to Clipboard</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://exampledelphi.com/delphi.php/files/delete-a-directory/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
