<?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>AutoIt Script</title>
	<atom:link href="http://www.autoitscript.ro/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.autoitscript.ro</link>
	<description>Curs AutoIt pentru incepatori</description>
	<lastBuildDate>Mon, 07 May 2012 22:00:00 +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>Bubble sort</title>
		<link>http://www.autoitscript.ro/algoritm/bubble-sort/</link>
		<comments>http://www.autoitscript.ro/algoritm/bubble-sort/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 23:06:43 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Algoritmi]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1401</guid>
		<description><![CDATA[Bubble sort este un algoritm de sortare care consta in parcurgerea unui vector si schimbarea a doua elemente adiacente daca valoarea elementului curent este mai mare decat valoarea elementului urmator. Operatia se repeta pana cand vectorul este sortat in intregime. La fiecare parcurgere a vectorului elementul cu valoarea cea mai mare ajunge ultimul in vector. [...]]]></description>
			<content:encoded><![CDATA[<p>Bubble sort este un algoritm de sortare care consta in parcurgerea unui vector si schimbarea a doua elemente adiacente daca valoarea elementului curent este mai mare decat valoarea elementului urmator. Operatia se repeta pana cand vectorul este sortat in intregime. La fiecare parcurgere a vectorului elementul cu valoarea cea mai mare ajunge ultimul in vector.</p>
<p>&nbsp;</p>
<p>Sa presupunem ca avem urmatorul vector cu 10 elemente:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Dim</span> <span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">87</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">24</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">11</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">68</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">42</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">9</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">100</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">15</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">9</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">76</span></pre></div></div>

<p>&nbsp;</p>
<p>Implementarea unei functii care efectueaza o sortare folosind acest algoritm, in AutoIt, poate fi cea de mai jos:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> BubbleSort<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByRef</span> <span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$i</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">UBound</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span> <span style="color: #0000FF; font-weight: bold;">Step</span> <span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
		<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$j</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="font-weight: bold; color: #AA0000;">$i</span>
			<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$j</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$j</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
				<span style="color: #0080FF; font-style: italic; font-weight: bold;">_ArraySwap</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$j</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$j</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
			<span style="color: #0000FF; font-weight: bold;">EndIf</span>
		<span style="color: #0000FF; font-weight: bold;">Next</span>
	<span style="color: #0000FF; font-weight: bold;">Next</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p><em><span style="color: #ff0000;">Nota:</span> functia <span style="color: #0080ff;">_ArraySwap</span> este definita in Array.au3</em></p>
<p>&nbsp;</p>
<p>Avand in vedere vectorul de mai sus, o prima trecere prin vector executand schimbari intre elementele adiacente, poate fi schitata ca in tabelul de mai jos. Cu culoarea rosu sunt reprezentate schimbarile de valori in vector iar cu albastru am reprezentat perechi adiacente care nu necesita schimbare de valori.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">87</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">24</span></p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right">100</p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">87</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">11</span></p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right">100</p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">87</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">68</span></p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right">100</p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">87</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">42</span></p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right">100</p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">87</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">9</span></p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right">100</p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">87</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">30</span></p>
</td>
<td valign="top" width="67">
<p align="right">100</p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #0000ff;">87</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #0000ff;">100</span></p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right">87</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">100</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">15</span></p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right">87</p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">100</span></p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #ff0000;">76</span></p>
</td>
</tr>
<tr>
<td valign="top" width="67">
<p align="right">24</p>
</td>
<td valign="top" width="67">
<p align="right">11</p>
</td>
<td valign="top" width="67">
<p align="right">68</p>
</td>
<td valign="top" width="67">
<p align="right">42</p>
</td>
<td valign="top" width="67">
<p align="right">9</p>
</td>
<td valign="top" width="67">
<p align="right">30</p>
</td>
<td valign="top" width="67">
<p align="right">87</p>
</td>
<td valign="top" width="67">
<p align="right">15</p>
</td>
<td valign="top" width="67">
<p align="right">76</p>
</td>
<td valign="top" width="67">
<p align="right"><span style="color: #008000;">100</span></p>
</td>
</tr>
</tbody>
</table>
<p>Se poate observa ca la finalul primei treceri prin vector, valoarea maxima ajunge pe ultima pozitie. Analog se executa treceri prin vector executand schimbari de valori, la fiecare trecere valoarea maxima ajunge in pozitie terminala (la fiecare trecere prin vector, numarul de pasi in vector se decrementeaza &#8211; plecand de la premisa ca pe ultima pozitie ajunge totdeauna valoarea maxima, nu mai este necesar ca vectorul sa fie parcurs in intregime).</p>
<p>Pentru o exemplificare mai buna a operatiilor efectuate de acest algoritm, urmariti animatia de mai jos:</p>
<p><a href="http://en.wikipedia.org/wiki/File:Bubble-sort-example-300px.gif" target="_blank"><img class="aligncenter size-full wp-image-1414" title="Bubble-sort-example-300px" src="http://www.autoitscript.ro/wp-content/uploads/2011/12/Bubble-sort-example-300px.gif" alt="" width="300" height="180" /></a></p>
<p>Un exemplu de utilizare a acestei functii:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;Array.au3&gt;</span> 
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Dim</span> <span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">87</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">24</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">11</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">68</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">42</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">9</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">100</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">15</span>
<span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">9</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">76</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_ArrayDisplay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Vector nesortat&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
BubbleSort<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_ArrayDisplay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Array</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Vector sortat&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> BubbleSort<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByRef</span> <span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$i</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">UBound</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span> <span style="color: #0000FF; font-weight: bold;">Step</span> <span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
		<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$j</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="font-weight: bold; color: #AA0000;">$i</span>
			<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$j</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$j</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
				<span style="color: #0080FF; font-style: italic; font-weight: bold;">_ArraySwap</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$j</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$j</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
			<span style="color: #0000FF; font-weight: bold;">EndIf</span>
		<span style="color: #0000FF; font-weight: bold;">Next</span>
	<span style="color: #0000FF; font-weight: bold;">Next</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/algoritm/bubble-sort/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accesarea Gmail</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/accesarea-gmail/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/accesarea-gmail/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 14:30:16 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1357</guid>
		<description><![CDATA[In unele cazuri veti dori sa verificati cat mai repede cu putinta daca aveti emailuri necitite, folosind serviciile Gmail. In acest tutorial voi prezenta doua metode pentru a realiza acest lucru. &#160; 1. Folosind functiile IE &#160; Pentru inceput avem nevoie de functiile IE si cele pentru managementul sirurilor de caractere. #include &#60;IE.au3&#62; #include &#60;String.au3&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>In unele cazuri veti dori sa verificati cat mai repede cu putinta daca aveti emailuri necitite, folosind serviciile Gmail. In acest tutorial voi prezenta doua metode pentru a realiza acest lucru.</p>
<p>&nbsp;<br />
<strong>1. Folosind functiile IE</strong><br />
&nbsp;<br />
Pentru inceput avem nevoie de functiile IE si cele pentru managementul sirurilor de caractere.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;IE.au3&gt;</span>
<span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;String.au3&gt;</span>
<span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;Array.au3&gt;</span> <span style="font-style: italic; color: #009933;">;doar pentru a afisa rezultatul</span></pre></div></div>

<p>&nbsp;<br />
Apoi vom declara doua variabile care contin datele de conectare:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$sEmail</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">'username@gmail.com'</span>
<span style="font-weight: bold; color: #AA0000;">$sPasswd</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">'parola'</span></pre></div></div>

<p><em><span style="color: #FF0000;">Nota:</span> modificati continutul cu date reale de conectare</em><br />
&nbsp;<br />
Cream un obiect(instanta) InternetExplorer:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$oIE</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IECreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">'https://mail.google.com/'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Ultimii parametri indica faptul ca nu se ataseaza unei ferestre existente si nu este o fereastra vizibila.<br />
&nbsp;<br />
Obtinem referintele pentru form-ul de logare si pentru fiecare element necesar pentru conectare (email, parola, butonul SignIn):</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$oForm</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormGetObjByName</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'gaia_loginform'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$oEmail</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementGetObjByName</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oForm</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'Email'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$oPasswd</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementGetObjByName</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oForm</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'Passwd'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$oSignIn</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementGetObjByName</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oForm</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'signIn'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Setam datele de logare si apasam butonul pentru conectare, apoi asteptam incarcarea paginii noi:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementSetValue</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oEmail</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$sEmail</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementSetValue</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oPasswd</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$sPasswd</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEAction</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oSignIn</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'click'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IELoadWait</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Obtinem sursa paginii:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$sHTML</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEBodyReadHTML</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Mai ramane sa ne deconectam si sa distrugem obiectul creat:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_IENavigate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'https://mail.google.com/mail/?logout&amp;hl=en'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEQuit</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Ajunsi in aceasta faza am terminat cu preluarea datelor, mai ramane sa gasim continutul dorit. Pentru acest lucru am creat functia <em>GetMessages</em>, avand ca parametru sursa paginii obtinuta anterior:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$Messages</span> <span style="color: #FF0000; font-weight: bold;">=</span> GetMessages<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sHTML</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_ArrayDisplay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Fiind un tutorial, pentru a pastra lucrurile cat mai simple, am ales sa afisam rezultatul sub forma matriceala dar pentru a arata mai bine se poate crea o interfata grafica.<br />
&nbsp;<br />
Functia <em>GetMessages</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> GetMessages<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sHTML</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$aMsg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sHTML</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;SPAN dir=ltr&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'e-mail options'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #000080; font-style: italic; font-weight: bold;">IsArray</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMsg</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Max</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">UBound</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMsg</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
		<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span>
		<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$Index</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="font-weight: bold; color: #AA0000;">$Max</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Info</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMsg</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;B&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/B&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
			<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #0000FF; font-weight: bold;">Not</span> <span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@error</span></span> <span style="color: #0000FF; font-weight: bold;">Then</span>
				<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
				<span style="color: #0000FF; font-weight: bold;">ReDim</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
				<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Info</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
				<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Info</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
			<span style="color: #0000FF; font-weight: bold;">EndIf</span>
		<span style="color: #0000FF; font-weight: bold;">Next</span>
		<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #0000FF; font-weight: bold;">False</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>In prima linie obtinem intr-un vector niste portiuni din codul sursa, specifice pentru fiecare mesaj. Daca au fost gasite astfel de portiuni atunci variabila <span style="color: #800000;">$aMsg</span> este cu siguranta un vector.<br />
Variabila <span style="color: #800000;">$Max</span> contine numarul total de mesaje (citite si necitite).<br />
Variabila <span style="color: #800000;">$Messages</span> o sa contina rezultatul functiei (este o matrice bidimensionala). Initial se creaza doar un index in matrice (inca nu stim cate mesaje sunt necitite), iar pe parcurs vom mai adauga indecsi. <span style="color: #800000;">$Messages[0][0]</span> este indexul la care stocam numarul de mesaje (emailuri) necitite, valoarea initiala este 0.<br />
Apoi verificam intr-o bucla <span style="color: #0000FF;">For&#8230;Next</span>, pentru fiecare portiune de cod HTML specific unui email, daca acesta este scris cu text care are atributul <strong>bold</strong>(specific unui email necitit). Daca se gasesc asemenea texte in portiunea de cod, acestEa reprezinta numele celui care a trimis emailul si subiectul acestuia. Pentru fiecare caz favorabil, se incrementeaza numarul mesajelor necitite, se redimensioneaza matricea care contine rezultatul final si se pun datele obtinute in matrice.<br />
In final se returneaza matricea care contine rezultatul sau valoarea booleana <span style="color: #0000FF;">False</span> in caz de eroare.<br />
&nbsp;<br />
Daca asamblati portiunile de cod de mai sus, obtineti urmatorul script:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;IE.au3&gt;</span>
<span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;String.au3&gt;</span>
<span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;Array.au3&gt;</span> <span style="font-style: italic; color: #009933;">;doar pentru a afisa rezultatul</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$sEmail</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">'username@gmail.com'</span>
<span style="font-weight: bold; color: #AA0000;">$sPasswd</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">'parola'</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$oIE</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IECreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">'https://mail.google.com/'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$oForm</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormGetObjByName</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'gaia_loginform'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$oEmail</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementGetObjByName</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oForm</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'Email'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$oPasswd</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementGetObjByName</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oForm</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'Passwd'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$oSignIn</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementGetObjByName</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oForm</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'signIn'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementSetValue</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oEmail</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$sEmail</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEFormElementSetValue</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oPasswd</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$sPasswd</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEAction</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oSignIn</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'click'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IELoadWait</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$sHTML</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEBodyReadHTML</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IENavigate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'https://mail.google.com/mail/?logout&amp;hl=en'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_IEQuit</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$oIE</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$Messages</span> <span style="color: #FF0000; font-weight: bold;">=</span> GetMessages<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sHTML</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_ArrayDisplay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> GetMessages<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sHTML</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$aMsg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sHTML</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;SPAN dir=ltr&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'e-mail options'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #000080; font-style: italic; font-weight: bold;">IsArray</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMsg</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Max</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">UBound</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMsg</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
		<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span>
		<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$Index</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="font-weight: bold; color: #AA0000;">$Max</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Info</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMsg</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;B&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/B&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
			<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #0000FF; font-weight: bold;">Not</span> <span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@error</span></span> <span style="color: #0000FF; font-weight: bold;">Then</span>
				<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
				<span style="color: #0000FF; font-weight: bold;">ReDim</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
				<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Info</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
				<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Info</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
			<span style="color: #0000FF; font-weight: bold;">EndIf</span>
		<span style="color: #0000FF; font-weight: bold;">Next</span>
		<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #0000FF; font-weight: bold;">False</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>&nbsp;<br />
&nbsp;<br />
<strong>2. Folosind un obiect <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106%28v=vs.85%29.aspx" target="_blank">WinHTTPRequest</a> si Gmail feed atom</strong><br />
&nbsp;<br />
Si in acest caz vom avea nevoie de functii pentru managementul sirurilor de caractere, deci vom avea nevoie de:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;String.au3&gt;</span>
<span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;Array.au3&gt;</span> <span style="font-style: italic; color: #009933;">;doar pentru a afisa rezultatul</span></pre></div></div>

<p>&nbsp;<br />
Apoi vom declara doua variabile care contin datele de conectare:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$sEmail</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">'username@gmail.com'</span>
<span style="font-weight: bold; color: #AA0000;">$sPasswd</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">'parola'</span></pre></div></div>

<p><em><span style="color: #FF0000;">Nota:</span> modificati continutul cu date reale de conectare</em><br />
&nbsp;<br />
Cream un obiect WinHTTPRequest, initiem o cerere GET, setam credentialele si trimitem cererea. Apoi asteptam un raspuns.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$oHTTP</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">ObjCreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">'WinHTTP.WinHTTPRequest.5.1'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">With</span> <span style="font-weight: bold; color: #AA0000;">$oHTTP</span>
	<span style="color: #FF0000; font-weight: bold;">.</span><span style="color: #0000FF; font-style: italic; font-weight: bold;">Open</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">'GET'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'https://gmail.google.com/gmail/feed/atom'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #FF0000; font-weight: bold;">.</span><span style="color: #0000FF; font-style: italic; font-weight: bold;">SetCredentials</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sEmail</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$sPasswd</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #FF0000; font-weight: bold;">.</span><span style="color: #000080; font-style: italic; font-weight: bold;">Send</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndWith</span>
<span style="font-weight: bold; color: #AA0000;">$sXML</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$oHTTP</span><span style="color: #FF0000; font-weight: bold;">.</span><span style="color: #0000FF; font-style: italic; font-weight: bold;">ResponseText</span></pre></div></div>

<p>&nbsp;<br />
In aceasta faza avem informatiile necesare, mai trebuie doar sa le aranjam intr-o forma utilizabila. Pentru acest lucru am scris functia <em>GetMessages</em>, avand ca parametru o variabila cu datele obtinute anterior. In felul urmator se apeleaza si afiseaza rezultatul functiei(sub forma matriceala):</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$Messages</span> <span style="color: #FF0000; font-weight: bold;">=</span> GetMessages<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sXML</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_ArrayDisplay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Functia <em>GetMessages</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> GetMessages<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sXML</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$New</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sXML</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;fullcount&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/fullcount&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$New</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">&lt;&gt;</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$New</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
		<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$New</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
		<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Entry</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sXML</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;entry&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/entry&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$Index</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="font-weight: bold; color: #AA0000;">$New</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$sName</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Entry</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;name&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/name&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
			<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$sTitle</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Entry</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;title&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/title&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
			<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$sName</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
			<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$sTitle</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
		<span style="color: #0000FF; font-weight: bold;">Next</span>
		<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #0000FF; font-weight: bold;">False</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>In prima linie se obitne numarul de emailuri necitite. Daca acest numar este diferit de 0 se trece la procesarea acestora.<br />
Se creaza o matrice bidimensionala care sa stocheze rezultatul functiei.<br />
La indexul [0][0] se stocheaza numarul total de emailuri necitite.<br />
In urmatoarea linie se obtine un vector cu date despre fiecare email.<br />
Apoi intr-o bucla <span style="color: #0000FF;">For&#8230;Next</span> se obtin doar datele care ne intereseaza(numele si subiectul mesajului) si se stocheaza in matricea cu rezultatele finale.<br />
La iesirea din bucla functia returneaza matricea cu emailuri necitite sau in caz de eroare se returneaza valoarea booleana <span style="color: #0000FF;">False</span><br />
&nbsp;<br />
Daca asamblati portiunile de cod scrise anterior, obtineti urmatorul script:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;String.au3&gt;</span>
<span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;Array.au3&gt;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$sEmail</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">'username@gmail.com'</span>
<span style="font-weight: bold; color: #AA0000;">$sPasswd</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">'parola'</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$oHTTP</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">ObjCreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">'WinHTTP.WinHTTPRequest.5.1'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">With</span> <span style="font-weight: bold; color: #AA0000;">$oHTTP</span>
	<span style="color: #FF0000; font-weight: bold;">.</span><span style="color: #0000FF; font-style: italic; font-weight: bold;">Open</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">'GET'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'https://gmail.google.com/gmail/feed/atom'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #FF0000; font-weight: bold;">.</span><span style="color: #0000FF; font-style: italic; font-weight: bold;">SetCredentials</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sEmail</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$sPasswd</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #FF0000; font-weight: bold;">.</span><span style="color: #000080; font-style: italic; font-weight: bold;">Send</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndWith</span>
<span style="font-weight: bold; color: #AA0000;">$sXML</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$oHTTP</span><span style="color: #FF0000; font-weight: bold;">.</span><span style="color: #0000FF; font-style: italic; font-weight: bold;">ResponseText</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$Messages</span> <span style="color: #FF0000; font-weight: bold;">=</span> GetMessages<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sXML</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_ArrayDisplay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> GetMessages<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sXML</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$New</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sXML</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;fullcount&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/fullcount&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$New</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">&lt;&gt;</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$New</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
		<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$New</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
		<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Entry</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sXML</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;entry&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/entry&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$Index</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="font-weight: bold; color: #AA0000;">$New</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$sName</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Entry</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;name&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/name&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
			<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$sTitle</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_StringBetween</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Entry</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;title&gt;'</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">'&lt;/title&gt;'</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
			<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$sName</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
			<span style="font-weight: bold; color: #AA0000;">$Messages</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$Index</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$sTitle</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
		<span style="color: #0000FF; font-weight: bold;">Next</span>
		<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Messages</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #0000FF; font-weight: bold;">False</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/accesarea-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GDI+ 2D Game Demo</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/2d-game-demo/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/2d-game-demo/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 16:23:41 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1307</guid>
		<description><![CDATA[Urmatorul tutorial a fost gandit pentru incepatori, pentru a intelege cum se creaza un joc simplu 2D, folosind GDI+. In acest tutorial nu veti intalni optimizari, trebuie sa tineti cont ca este un joc demonstrativ. De preferat este sa fiti familiarizati cu tutorialele Interfata personalizata cu WinAPI, Double Buffering si Coliziunea Obiectelor pentru o mai [...]]]></description>
			<content:encoded><![CDATA[<p>Urmatorul tutorial a fost gandit pentru incepatori, pentru a intelege cum se creaza un joc simplu 2D, folosind GDI+. In acest tutorial nu veti intalni optimizari, trebuie sa tineti cont ca este un joc demonstrativ.</p>
<p>De preferat este sa fiti familiarizati cu tutorialele <a href="http://www.autoitscript.ro/tutorial-autoit/interfata-personalizata/">Interfata personalizata cu WinAPI</a>, <a href="http://www.autoitscript.ro/tutorial-autoit/double-buffering/">Double Buffering</a> si <a href="http://www.autoitscript.ro/tutorial-autoit/coliziunea-obiectelor/">Coliziunea Obiectelor</a> pentru o mai buna intelegere a acestui tutorial.<br />
&nbsp;<br />
Pentru inceput o sa avem nevoie de doua fisiere antet pentru a putea accesa functiile GDI+ si cele pentru managementul sunetelor.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;GDIPlus.au3&gt;</span>
<span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;Sound.au3&gt;</span></pre></div></div>

<p>Mai avem nevoie de cateva variabile cu scop global, pe care le vom folosi in diverse functii:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hMob</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hGate</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span>
<span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$GameOver</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$GameFinish</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$Pause</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$Sound</span></pre></div></div>

<p><span style="color: #800000;">$hMain</span> este handle-ul ferestrei principale<br />
<span style="color: #800000;">$hWall</span> este handle-ul imaginii pentru zid<br />
<span style="color: #800000;">$hPlayer</span> este handle-ul imaginii pentru jucator<br />
<span style="color: #800000;">$hMob</span> este handle-ul imaginii pentru mob<br />
<span style="color: #800000;">$hGate</span> este handle-ul imaginii pentru poarta<br />
<span style="color: #800000;">$hGraphics</span> este handle-ul unui obiect Graphics (suprafata de desenare)<br />
<span style="color: #800000;">$hClone</span> este handle-ul unei obiect Bitmap (portiunea in care se desfasoara actiunea jocului)<br />
<span style="color: #800000;">$hBackBuffer</span> este handle-ul unui obiect Graphics (buffer in memorie pentru operatiile de desenare)<br />
<span style="color: #800000;">$GameOver</span> este o variabila booleana care indica daca jucatorul a pierdut (mancat de mob)<br />
<span style="color: #800000;">$GameFinish</span> este o variabila booleana care indica daca jucatorul a terminat jocul (a intrat pe poarta)<br />
<span style="color: #800000;">$Pause</span> este o variabila booleana care indica daca jocul este suspendat(pauza) pentru o perioada de timp<br />
<span style="color: #800000;">$Sound</span> contine sound ID-ul melodiei de fundal<br />
&nbsp;<br />
Cream cele 3 obiecte care vor interactiona in joc:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">390</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$ObjMob</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">210</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">210</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">390</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$ObjGate</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">390</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">390</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Incarcam resursele grafice (directorul curent\Gfx):</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Startup</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hWall</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageLoadFromFile</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Wall.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hPlayer</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageLoadFromFile</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Player.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hMob</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageLoadFromFile</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Mob.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hGate</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageLoadFromFile</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Gate.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Cream fereastra principala, desenam o imagine de fundal si cream butoanele de minimizare si inchidere a programului:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;GDI+ 2D Game Demo&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">458</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">505</span><span style="color: #FF0000; font-weight: bold;">,-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span>0x80000000<span style="color: #FF0000; font-weight: bold;">,</span>0x00000008<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBackground</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Background.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">458</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">505</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hLabel</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreateLabel</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;GDI+ 2D Game Demo&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">150</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">18</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hMinimize</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Minimize.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">415</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hClose</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Close.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">435</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetColor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hLabel</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFFFFFF<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetBkColor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hLabel</span><span style="color: #FF0000; font-weight: bold;">,</span>0x000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetFont</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hLabel</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">600</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Garamond&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackground</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">128</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Fereastra principala nu are bara de titlu si butoane de sistem (stilul <span style="color: #800000;">$WS_POPUP</span>), fapt pentru care cream manual un control Pic pentru imaginea de fundal, un control Label pentru titlu si alte doua controale Pic pentru butoanele de minimizare si inchidere. Pentru controlul care pastreaza titlul se seteaza culoarea textului, a fundalului si fontul, iar controlul care pastreaza imaginea de fundal este dezactivat. In final se seteaza fereastra principala ca fiind vizibila.<br />
&nbsp;<br />
Urmatorul lucru de care ne vom ocupa este sunetul de fundal:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">SoundSetWaveVolume</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">50</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$Sound</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundOpen</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Snd\Medley.wav&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundPlay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Initial setam volumul la 50% (depinde de performantele audio de care dispuneti, puteti modifica valoare dupa preferinta), deschidem fisierul care contine melodia de fundal si pornim melodia.<br />
&nbsp;<br />
In continuare ne vom ocupa de crearea suprafetelor de desenare:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$hGraphics</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsCreateFromHWND</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBitmap</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapCreateFromGraphics</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">458</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">505</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hClone</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapCloneArea</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">21</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">450</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">480</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$GDIP_PXF24RGB</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageGetGraphicsContext</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Am explicat mai sus ce inseamna fiecare, cu exceptia <span style="color: #800000;">$hBitmap</span> care este handle-ul unui obiect Bitmap specific pentru intreaga fereastra, dar in cazul nostru nu vrem sa redesenam peste bara de titlu, marginile ferestrei si butoanele de minimizare si inchidere. De aceea suprafata activa va fi cea in care se desfasoara jocul, implicit portiunea clonata din acest <span style="color: #800000;">$hBitmap</span>.<br />
&nbsp;<br />
Trebuie sa ne gandim si la cazul in care fereastra este restaurata dupa o minimizare sau daca fereastra este scoasa in afara ecranului si apoi readusa pe ecran, etc. Toate aceste evenimente vor distruge ce a fost desenat cu GDI+. In consecinta, cand unul din aceste evenimente are loc imaginea din buffer trebuie redesenata pe ecran. Pentru a apela functia de redesenare cand aceste evenimente au loc, folosim urmatoarele doua linii:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">GUIRegisterMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0x85<span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;REPAINT&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUIRegisterMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0x0F<span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;REPAINT&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Prima linie apeleaza functia <em>REPAINT</em> cand se intercepteaza mesajul <a href="http://msdn.microsoft.com/en-us/library/dd145212%28v=vs.85%29.aspx" target="_blank">WM_NCPAINT</a>. A doua linie apeleaza functia <em>REPAINT</em> cand se intercepteaza mesajul <a href="http://msdn.microsoft.com/en-us/library/dd145213%28v=vs.85%29.aspx" target="_blank">WM_PAINT</a>.<br />
&nbsp;<br />
Urmeaza liniile de cod care ii permit userului sa miste jucatorul, sa puna pauza si pe ultima linie se inregistreaza apelul functiei <em>MoveMobRandom</em> la fiecare secunda, pentru a misca mobul:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{UP}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveUp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{DOWN}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveDown&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{LEFT}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveLeft&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{RIGHT}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveRight&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{PAUSE}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Pause&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
AdlibRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Apoi urmeaza bucla principala:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Do</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUIGetMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span>
			<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SendMessage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">,</span>0x0112<span style="color: #FF0000; font-weight: bold;">,</span>0xF012<span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$hMinimize</span>
			<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_MINIMIZE</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$hClose</span>
			<span style="color: #0000FF; font-weight: bold;">ExitLoop</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundStatus</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">&lt;&gt;</span> <span style="font-weight: bold; color: #9977BB;">&quot;playing&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">And</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">Not</span> <span style="font-weight: bold; color: #AA0000;">$Pause</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundPlay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsClear</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFF000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">450</span> <span style="color: #0000FF; font-weight: bold;">Step</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">450</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Next</span>
	<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">480</span> <span style="color: #0000FF; font-weight: bold;">Step</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Next</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		AdlibUnRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="font-weight: bold; color: #AA0000;">$GameOver</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">True</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjGate</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		AdlibUnRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="font-weight: bold; color: #AA0000;">$GameFinish</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">True</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjGate</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hGate</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjGate</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjGate</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">21</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Until</span> <span style="font-weight: bold; color: #AA0000;">$GameOver</span> <span style="color: #0000FF; font-weight: bold;">Or</span> <span style="font-weight: bold; color: #AA0000;">$GameFinish</span></pre></div></div>

<p>Codul sursa continut in interiorul buclei principala poate fi impartit in 6 parti:<br />
1. Expresia conditionala care gestioneaza mesajele interceptate de fereastra pincipala (Primary Down, Minimize si Close)<br />
2. Linia in care se testeaza daca melodia de fundal continua sa ruleze, in caz contrar (daca nu este in modul pauza) melodia este rulata iar<br />
3. Linia in care se curata bufferul din memorie, in care se deseneaza<br />
4. Cele doua bucle <span style="color: #0000FF;">For&#8230;Next</span>, in care se deseneaza zidurile marginale in buffer<br />
5. Testarea celor 3 posibile coliziuni: jucator-mob, jucator-poarta sau mob-poarta. In cazul coliziunii jucator-mob, variabila <span style="color: #800000;">$GameOver</span> este setata ca <span style="color: #0000FF;">True</span>, bucla va rula pentru ultima data (pentru desenare). In cazul coliziunii jucator-poarta, variabila <span style="color: #800000;">$GameFinish</span> este setata ca <span style="color: #0000FF;">True</span>, bucla va rula pentru ultima data (pentru desenare). In cazul coliziunii mob-poarta (am vrut ca acest lucru sa fie interzis), pozitia mobului este reactualizata in partea stanga a portii.<br />
6. Desenarea jucatorului, mobului si a portii in buffer, apoi copierea bufferului pe suprafata de desenare.</p>
<p>Iesirea din bucla are loc in 3 cazuri: daca userul apasa butonul Close(x), in cazul in care jucatorul este mancat de mob sau in cazul in care jucatorul intra pe poarta.<br />
&nbsp;<br />
La iesirea din bucla principala se opreste melodia de fundal si se inchide fisierul care contine melodia:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundStop</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundClose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Urmeaza partea in care este tratat finalul jocului (cauza):</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$GameOver</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
	<span style="font-weight: bold; color: #AA0000;">$Sound</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundOpen</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Snd\Over.wav&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Game Over&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Mancat de mob&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">ElseIf</span> <span style="font-weight: bold; color: #AA0000;">$GameFinish</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Game Finish&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Ajuns la poarta&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$Sound</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundOpen</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Snd\Finish.wav&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Else</span>
	<span style="font-weight: bold; color: #AA0000;">$Sound</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundOpen</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Snd\Exit.wav&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exit&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Userul a inchis jocul&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndIf</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundPlay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Se testeaza daca iesirea din bucla principala s-a datorat faptului ca jucatorul a fost mancat de mob. Daca acesta este motivul se deschide si reda o melodie care indica acest lucru, plus un mesaj vizual care persista 5 secunde.<br />
Daca motivul pentru iesirea din bucla principala s-a datorat faptului ca jucatorul a intrat pe poarta, la fel se deschide si reda o melodie care indica acest lucru, plus un mesaj vizual care persista 5 secunde.<br />
Pentru oricare alt caz (incluzand cazul in care userul inchide aplicatia) se deschide si reda o melodie care indica acest lucru, plus un mesaj vizual care persista 5 secunde.<br />
&nbsp;<br />
Mai trebuie doar oprita melodia care este redata (pentru unul din cazurile de mai sus) si inchis fisierul care contine melodia.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundStop</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundClose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Apoi eliberate resursele folosite:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGate</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMob</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hPlayer</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Functiile apelate pentru miscarea jucatorului:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> MoveUp<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> MoveDown<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> MoveLeft<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> MoveRight<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>In fond, pentru fiecare directie noua este reactualizata pozitia obiectului asociat jucatorului, cu 30 pixeli, plus sau minus.<br />
&nbsp;<br />
Functia care misca mobul:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> MoveMobRandom<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Random</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Se genereaza un numar aleator intre 1-4, fiecare corespunzator unei directii. Pentru fiecare directie se reactualizeaza pozitia obiectului asociat mobului cu 30 pixeli, plus sau minus.<br />
&nbsp;<br />
Functia care trateaza suspendarea/redarea actiunilor:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> Pause<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$Pause</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">Not</span> <span style="font-weight: bold; color: #AA0000;">$Pause</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Pause</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		AdlibUnRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{UP}&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{DOWN}&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{LEFT}&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{RIGHT}&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundPause</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Else</span>
		AdlibRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{UP}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveUp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{DOWN}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveDown&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{LEFT}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveLeft&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{RIGHT}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveRight&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundResume</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>In prima linie se trece din starea intial in alta stare (<span style="color: #0000FF;">True</span>-><span style="color: #0000FF;">False</span> sau <span style="color: #0000FF;">False</span>-><span style="color: #0000FF;">True</span>).<br />
Daca valoarea curenta este <span style="color: #0000FF;">True</span>(pauza) atunci se dezactiveaza apelarea functiei care misca mobul, se dezactiveaza tastele asociate pentru miscarea jucatorului si melodia de fundal este pusa pe pauza.<br />
Daca valoarea curenta este <span style="color: #0000FF;">False</span>(iesire din modul pauza) se reactiveaza apelarea functiei care misca mobul, se reactiveaza tastele asociate pentru miscarea jucatorului si melodia de fundal este reluata.<br />
&nbsp;<br />
Functia pentru redesenare (WM_PAINT si WM_NCPAINT):</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> REPAINT<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hWnd</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$msg</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$wParam</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$lParam</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
    <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">21</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
    <span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_WinAPI_DefWindowProc</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hWnd</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$msg</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$wParam</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$lParam</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Se copiaza bufferul din memorie pe suprafata de desenare.<br />
&nbsp;<br />
Functiile pentru lucrul cu obiecte (identice cu cele descrise in tutorialul <a href="http://www.autoitscript.ro/tutorial-autoit/coliziunea-obiectelor/">Coliziunea Obiectelor</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$W</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$H</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Object</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$W</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$H</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Object</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByRef</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
   	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
   	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$X</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Y</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
    <span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$SX</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Abs</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
    <span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$SY</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Abs</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
    <span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$SX</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">And</span> <span style="font-weight: bold; color: #AA0000;">$SY</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>&nbsp;<br />
&nbsp;<br />
Daca asamblati toate portiunile de cod sursa de mai sus, scriptul arata asa:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;GDIPlus.au3&gt;</span>
<span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;Sound.au3&gt;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hMob</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hGate</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span>
<span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$GameOver</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$GameFinish</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$Pause</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$Sound</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">390</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$ObjMob</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">210</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">210</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">390</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Global</span> <span style="font-weight: bold; color: #AA0000;">$ObjGate</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">390</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">390</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Startup</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hWall</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageLoadFromFile</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Wall.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hPlayer</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageLoadFromFile</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Player.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hMob</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageLoadFromFile</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Mob.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hGate</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageLoadFromFile</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Gate.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;GDI+ 2D Game Demo&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">458</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">505</span><span style="color: #FF0000; font-weight: bold;">,-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span>0x80000000<span style="color: #FF0000; font-weight: bold;">,</span>0x00000008<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBackground</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Background.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">458</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">505</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hLabel</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreateLabel</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;GDI+ 2D Game Demo&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">150</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">18</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hMinimize</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Minimize.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">415</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hClose</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Gfx\Close.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">435</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetColor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hLabel</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFFFFFF<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetBkColor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hLabel</span><span style="color: #FF0000; font-weight: bold;">,</span>0x000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetFont</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hLabel</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">600</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Garamond&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackground</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">128</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000080; font-style: italic; font-weight: bold;">SoundSetWaveVolume</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">50</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$Sound</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundOpen</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Snd\Medley.wav&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundPlay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$hGraphics</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsCreateFromHWND</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBitmap</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapCreateFromGraphics</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">458</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">505</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hClone</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapCloneArea</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">21</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">450</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">480</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$GDIP_PXF24RGB</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageGetGraphicsContext</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000080; font-style: italic; font-weight: bold;">GUIRegisterMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0x85<span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;REPAINT&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUIRegisterMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0x0F<span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;REPAINT&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{UP}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveUp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{DOWN}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveDown&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{LEFT}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveLeft&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{RIGHT}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveRight&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{PAUSE}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Pause&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
AdlibRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Do</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUIGetMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span>
			<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SendMessage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">,</span>0x0112<span style="color: #FF0000; font-weight: bold;">,</span>0xF012<span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$hMinimize</span>
			<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_MINIMIZE</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$hClose</span>
			<span style="color: #0000FF; font-weight: bold;">ExitLoop</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundStatus</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">&lt;&gt;</span> <span style="font-weight: bold; color: #9977BB;">&quot;playing&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">And</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">Not</span> <span style="font-weight: bold; color: #AA0000;">$Pause</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundPlay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsClear</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFF000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">450</span> <span style="color: #0000FF; font-weight: bold;">Step</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">450</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Next</span>
	<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">480</span> <span style="color: #0000FF; font-weight: bold;">Step</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">420</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Next</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		AdlibUnRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="font-weight: bold; color: #AA0000;">$GameOver</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">True</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjGate</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		AdlibUnRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="font-weight: bold; color: #AA0000;">$GameFinish</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">True</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjGate</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hGate</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjGate</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjGate</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">21</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Until</span> <span style="font-weight: bold; color: #AA0000;">$GameOver</span> <span style="color: #0000FF; font-weight: bold;">Or</span> <span style="font-weight: bold; color: #AA0000;">$GameFinish</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundStop</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundClose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$GameOver</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
	<span style="font-weight: bold; color: #AA0000;">$Sound</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundOpen</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Snd\Over.wav&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Game Over&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Mancat de mob&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">ElseIf</span> <span style="font-weight: bold; color: #AA0000;">$GameFinish</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Game Finish&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Ajuns la poarta&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$Sound</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundOpen</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Snd\Finish.wav&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Else</span>
	<span style="font-weight: bold; color: #AA0000;">$Sound</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundOpen</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;\Snd\Exit.wav&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exit&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Userul a inchis jocul&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndIf</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundPlay</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundStop</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundClose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGate</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMob</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hPlayer</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hWall</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> MoveUp<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> MoveDown<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> MoveLeft<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> MoveRight<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjPlayer</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> MoveMobRandom<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Random</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$ObjMob</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> Pause<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$Pause</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0000FF; font-weight: bold;">Not</span> <span style="font-weight: bold; color: #AA0000;">$Pause</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Pause</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		AdlibUnRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{UP}&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{DOWN}&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{LEFT}&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{RIGHT}&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundPause</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Else</span>
		AdlibRegister<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveMobRandom&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{UP}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveUp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{DOWN}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveDown&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{LEFT}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveLeft&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">HotKeySet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;{RIGHT}&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;MoveRight&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SoundResume</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Sound</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> REPAINT<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hWnd</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$msg</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$wParam</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$lParam</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
    <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hClone</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">21</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
    <span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_WinAPI_DefWindowProc</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hWnd</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$msg</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$wParam</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$lParam</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$W</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$H</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Object</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$W</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$H</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Object</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByRef</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
   	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
   	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$X</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Y</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
    <span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$SX</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Abs</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
    <span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$SY</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Abs</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
    <span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$SX</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">And</span> <span style="font-weight: bold; color: #AA0000;">$SY</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>&nbsp;<br />
Daca rulati scriptul, fereastra care va aparea o sa fie asemanatoare cu cea de mai jos:<br />
<img class="aligncenter size-full wp-image-1351" title="Pic1" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic136.png" alt="" width="458" height="505" /><br />
&nbsp;<br />
<em><span style="color: #FF0000;">Nota:</span> multumiri pentru sunetul de fundal lui Pippo Noviello (aka <a href="http://www.youtube.com/user/Kaminari3" target="_blank">Kaminari3</a>)</em>.<br />
&nbsp;<br />
Puteti descarca scriptul, resursele si o versiune compilata de <a href="http://download.autoitscript.ro/andy/GameDemo.rar">aici</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/2d-game-demo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coliziunea obiectelor</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/coliziunea-obiectelor/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/coliziunea-obiectelor/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 15:03:27 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1244</guid>
		<description><![CDATA[In special pentru pasionatii de jocuri, este important sa stiti cand doua obiecte se lovesc reciproc. In acest tutorial vom aborda forme simple ale obiectelor si vom invata sa testam daca exista o coliziune intre acestea. &#160; Ca un prim exemplu vom lua doua obiecte dreptunghiulare (sau patrate). Pentru simulare vom folosi functii GDI+, in [...]]]></description>
			<content:encoded><![CDATA[<p>In special pentru pasionatii de jocuri, este important sa stiti cand doua obiecte se lovesc reciproc. In acest tutorial vom aborda forme simple ale obiectelor si vom invata sa testam daca exista o coliziune intre acestea.</p>
<p>&nbsp;</p>
<p>Ca un prim exemplu vom lua doua obiecte dreptunghiulare (sau patrate). Pentru simulare vom folosi functii GDI+, in concluzie prima linie din script este:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;GDIPlus.au3&gt;</span></pre></div></div>

<p>Apoi vom crea o fereastra pentru simulare:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exemplu&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Pentru aceasta simulare avem nevoie de trei functii:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$W</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$H</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Object</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$W</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$H</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Object</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Functia <em>CreateObject</em> creaza un array cu caracteristicile unui obiect (coordonatele punctului de la care incepe obiectul, latimea, inaltimea si coorodonatele minime si maxime pentru X si Y pe care se poate misca obiectul).</p>
<p>Poate imaginea de mai jos este mai sugestiva:</p>
<p><img class="aligncenter size-full wp-image-1254" title="Pic1" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic135.png" alt="" width="200" height="200" /></p>
<p>Daca consideram patratul negru (fereastra 200&#215;200), pentru MaxX = 160 si MaxY = 160, in coltul dreapta-jos ramane exact spatiul de desenare pentru un patrat cu latimea 40 si inaltimea 40. Deci <em>MaxX = latimea ferestrei &#8211; latimea patratului</em> si <em>MaxY = inaltimea ferestrei &#8211; inaltimea patratului</em>.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByRef</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
   	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
   	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$X</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Y</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Functia <em>UpdateObject</em> o vom folosi pentru a seta o noua pozitie obiectului. Primele 4 conditii testeaza noua pozitie sa nu fie in afara limitelor impuse iar ultimele doua seteaza pozitia.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
    <span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$SX</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Abs</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
    <span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$SY</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Abs</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
    <span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$SX</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">And</span> <span style="font-weight: bold; color: #AA0000;">$SY</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Functia <em>ObjectOverlap</em> verifica daca cele doua obiecte au ajuns in contact. Imaginea de mai jos este sugestiva:</p>
<p><img class="aligncenter size-full wp-image-1265" title="Pic2" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic227.png" alt="" width="200" height="200" /></p>
<p>Pentru oricare doua obiecte, daca valoarea SX este mai mica decat suma latimiilor obiectelor atunci cele doua obiecte se suprapun pe verticala. Daca valoarea SY este mai mica decat suma inaltimiilor obiectelor atunci cele doua obiecte se suprapun pe orizontala. Pentru a  determina coliziunea dintre doua obiecte, trebuie indeplinite ambele conditii.</p>
<p>&nbsp;</p>
<p>Cream suprafata de desenare, bufferul in memorie pentru <em>Double Buffering</em> si doua obiecte Brush cu care desenam patratele.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Startup</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hGraphics</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsCreateFromHWND</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBitmap</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapCreateFromGraphics</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageGetGraphicsContext</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBrush1</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushCreateSolid</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xFFFF0000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBrush2</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushCreateSolid</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xFF00FF00<span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Inainte de a incepe verificarea coliziunii intr-o bucla, trebuie sa cream cele doua obiecte:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$Step</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span>
<span style="font-weight: bold; color: #AA0000;">$Obj1</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$Obj2</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Variabila <span style="color: #800000;">$Step</span> reprezinta pasul cu care se vor misca obiectele in simulare.</p>
<p>In bucla principala trebuie facute trei lucruri importante: generarea unei noi pozitii pentru obiect (aleator in cazul nostru), reactualizarea pozitiei pentru obiect si desenarea acestuia pe suprafata de desenare. Bucla principala arata asa:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Do</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Random</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsClear</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFF000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillRect</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillRect</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Until</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>In bucla, primul lucru care se face este generarea unei noi pozitii pentru unul din obiecte. Pentru aceasta folosim o expresie conditionala cu un numar aleator intre 1-8. Primele 4 cazuri simuleaza miscarea (pozitiva si negativa) pe axa X, respectiv miscarea (pozitiva si negativa) pe axa Y, pentru primul obiect. Ultimele 4 cazuri simuleaza miscarea (pozitiva si negativa) pe axa X, respectiv miscarea (pozitiva si negativa) pe axa Y, pentru al doilea obiect.</p>
<p>Pentru oricare din aceste cazuri se efectueaza o operatie de reactualizare a pozitiei pentru un obiect.</p>
<p>Ultimele linii ale buclei curata bufferul, deseneaza obiectele in buffer si apoi copiaza imaginea din buffer pe ecran. Dupa cum stiti, pentru a nu suprasolicita CPU, in bucle se folosesc pauze scurte, in acest caz durata pauzei o sa fie proportionala cu pasul de miscare al obiectelor.</p>
<p>Bucla ruleaza in acest mod pana cand cele doua obiecte ajung in coliziune.</p>
<p>La iesirea din bucla se afiseaza mesajul de atentionare ca obiectele sunt in coliziune, timp de 5 secunde.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Coliziune&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Obiectele au ajuns in contact.&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Mai trebuie doar sa eliberam resursele GDI+ folosite:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBrush1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBrush2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;</p>
<p>Daca asamblam portiunile de cod sursa de mai sus obtinem urmatorul script (pentru vizibilitate am pus functiile la final):</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;GDIPlus.au3&gt;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exemplu&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Startup</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hGraphics</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsCreateFromHWND</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBitmap</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapCreateFromGraphics</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageGetGraphicsContext</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBrush1</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushCreateSolid</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xFFFF0000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBrush2</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushCreateSolid</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xFF00FF00<span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$Step</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span>
<span style="font-weight: bold; color: #AA0000;">$Obj1</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$Obj2</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">160</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Do</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Random</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsClear</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFF000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillRect</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillRect</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Until</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Coliziune&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Obiectele au ajuns in contact.&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBrush1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBrush2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$W</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$H</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Object</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$W</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$H</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Object</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByRef</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
   	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
   	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$X</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Y</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
    <span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$SX</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Abs</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
    <span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$SY</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Abs</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
    <span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$SX</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">And</span> <span style="font-weight: bold; color: #AA0000;">$SY</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">+</span> <span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>&nbsp;</p>
<p>&nbsp;<br />
Asemanator este si pentru alte tipuri de obiecte. Spre exemplu pentru cercuri, functia <em>CreateObject</em> poate arata in felul urmator:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$R</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Object</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$R</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Object</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Pentru un cerc vor fi importante coordonatele centrului cercului si raza acestuia. Restul parametrilor raman neschimbati.<br />
&nbsp;<br />
Functia <em>UpdateObject</em> ramane neschimbata, X si Y reprezentand centrul obiectului(cercului).<br />
&nbsp;<br />
Din ecuatia cercului se poate obtine si formula pentru a verifica cand doua cercuri sunt in contact, deci vom avea functia:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">^</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">^</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">^</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Altfel spus cand <em>(R1+R2)^2 > ((X2-X1)^2 + (Y2-Y1)^2)</em> cele doua cercuri sunt in contact, unde X si Y sunt coordonatele pentru centrul cercului si R este raza cercului (indexul 1 sau 2 indica daca este vorba despre primul sau al doilea obiect).<br />
&nbsp;<br />
Singurul lucru care poate fi derutant este la desenarea cercurilor pe ecran. In AutoIt, cercul este o elipsa in care latimea este egala cu inaltimea si pentru care X si Y nu reprezinta centrul cercului ci coordonatele punctului de la care incepe desenarea elipsei. Acest lucru poate fi scris la desenare in felul urmator:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillEllipse</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillEllipse</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;<br />
Altfel spus coordonatele elipsei sunt: X = coordonata X a centrului cercului &#8211; raza, Y = coordonata Y a centrul cercului &#8211; raza, W = raza cercului * 2 si H = raza cercului * 2.<br />
&nbsp;<br />
Un script care verifica daca doua cercuri ajung in contact poate arata asa:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;GDIPlus.au3&gt;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exemplu&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Startup</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hGraphics</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsCreateFromHWND</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBitmap</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapCreateFromGraphics</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageGetGraphicsContext</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBrush1</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushCreateSolid</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xFFFF0000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBrush2</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushCreateSolid</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xFF00FF00<span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$Step</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span>
<span style="font-weight: bold; color: #AA0000;">$Obj1</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">180</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">180</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$Obj2</span> <span style="color: #FF0000; font-weight: bold;">=</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">180</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">180</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">180</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">180</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Do</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Random</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">8</span>
			UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsClear</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFF000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillEllipse</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillEllipse</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Step</span><span style="color: #FF0000; font-weight: bold;">*</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Until</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000080; font-style: italic; font-weight: bold;">TrayTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Coliziune&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Obiectele au ajuns in contact.&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5000</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBrush1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBrush2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> CreateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$R</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$Object</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$R</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MinY</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$MaxY</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$Object</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> UpdateObject<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByRef</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Y</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">4</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&lt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #0000FF; font-weight: bold;">Then</span> <span style="font-weight: bold; color: #AA0000;">$Y</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$X</span>
	<span style="font-weight: bold; color: #AA0000;">$Obj</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$Y</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> ObjectsOverlap<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">^</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">&gt;</span> <span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">^</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$Obj2</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="font-weight: bold; color: #AA0000;">$Obj1</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">^</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/coliziunea-obiectelor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GDI+ Double Buffering</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/double-buffering/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/double-buffering/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 12:59:24 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1224</guid>
		<description><![CDATA[Daca ati folosit functiile GDI+ pentru desenare, probabil ati observat inconvenientul cauzat de multiple operatii de desenare pe ecran, care cauzeaza un tremur al imaginii (flickers). Acest lucru se poate observa usor intr-o bucla in care se simuleaza miscarea unui obiect. &#160; In exemplul de mai jos simulam miscare unui patrat, de culoare albastra, din [...]]]></description>
			<content:encoded><![CDATA[<p>Daca ati folosit functiile GDI+ pentru desenare, probabil ati observat inconvenientul cauzat de multiple operatii de desenare pe ecran, care cauzeaza un tremur al imaginii (flickers). Acest lucru se poate observa usor intr-o bucla in care se simuleaza miscarea unui obiect.</p>
<p>&nbsp;</p>
<p>In exemplul de mai jos simulam miscare unui patrat, de culoare albastra, din partea stanga spre partea dreapta a ferestrei (observati inconvenientul despre care vorbeam putin mai sus).</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;GDIPlus.au3&gt;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exemplu&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Startup</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hGraphics</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsCreateFromHWND</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBrush</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushCreateSolid</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xFF000080<span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">400</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsClear</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFF000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillRect</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">180</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Next</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBrush</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;</p>
<p>Acest inconvenient dispare daca vom folosi tehnica numita <em>Double Buffering</em>. Aceasta tehnica consta in crearea unui buffer in memorie in care vor fi randate toate operatiile de desenare, in loc sa fie desenate pe ecran. Dupa ce sunt finalizate toate operatiile de desenare bufferul este copiat pe suprafata de desenare asociata acestuia. Daca ati prins ideea, este utilizata doar o operatie de desenare pe ecran, astfel inconvenientul provocat de desenarile multiple dispare.</p>
<p>&nbsp;</p>
<p>Acelasi exemplu in care simulam miscarea patratului dar de aceasta data imaginea este stabila.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;GDIPlus.au3&gt;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exemplu&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Startup</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-style: italic; color: #009933;">; Suprafata de desenare</span>
<span style="font-weight: bold; color: #AA0000;">$hGraphics</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsCreateFromHWND</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBitmap</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapCreateFromGraphics</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">400</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">400</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-style: italic; color: #009933;">; Suprafata de desenare din memorie (buffer)</span>
<span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_ImageGetGraphicsContext</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hBrush</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushCreateSolid</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0xFF000080<span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$X</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">400</span>
	<span style="font-style: italic; color: #009933;">; Operatii de desenare in buffer</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsClear</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span>0xFF000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsFillRect</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$X</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">180</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBrush</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-style: italic; color: #009933;">; Desenare pe ecran</span>
	<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDrawImage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Next</span>
&nbsp;
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BrushDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBrush</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBackBuffer</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_BitmapDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hBitmap</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_GraphicsDispose</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGraphics</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0080FF; font-style: italic; font-weight: bold;">_GDIPlus_Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/double-buffering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crearea unei interfete grafice personalizata</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/interfata-personalizata/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/interfata-personalizata/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 11:41:47 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1202</guid>
		<description><![CDATA[Daca va doriti o interfata mai deosebita pentru aplicatia dumneavoastra atunci acest tutorial o sa fie foarte util in acest sens. &#160; In acest tutorial vom avea nevoie de functii WinAPI deci prima linie din codul sursa este: &#160; #include &#60;WinAPI.au3&#62; &#160; Urmatoarele linii vor constitui interfata grafica: &#160; $hMain = GUICreateEx&#40;&#34;Exemplu&#34;,300,250,-1,-1,&#34;Background.bmp&#34;&#41; $hMinimize = GUICtrlCreatePic&#40;&#34;Minimize.bmp&#34;,105,215,40,30&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Daca va doriti o interfata mai deosebita pentru aplicatia dumneavoastra atunci acest tutorial o sa fie foarte util in acest sens.</p>
<p>&nbsp;</p>
<p>In acest tutorial vom avea nevoie de functii WinAPI deci prima linie din codul sursa este:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;WinAPI.au3&gt;</span></pre></div></div>

<p>&nbsp;</p>
<p>Urmatoarele linii vor constitui interfata grafica:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> GUICreateEx<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exemplu&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">300</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">250</span><span style="color: #FF0000; font-weight: bold;">,-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Background.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hMinimize</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Minimize.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">105</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">215</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hClose</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Close.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">155</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">215</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>La prima linie apelam functia <em>GUICreateEx</em> (despre care vom vorbi un pic mai jos) care creaza fereastra principala. Urmatoarele doua linii sunt controalele pentru butonul de minimizare (_) si inchidere (x). Ultima linie face vizibila fereastra principala.</p>
<p>Imaginile necesare pentru interfata le puteti descarca de <a href="http://download.autoitscript.ro/andy/CG_Resurse.rar">aici</a>.</p>
<p>&nbsp;</p>
<p>Urmatoarele linii reprezinta bucla principala a programului:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">While</span> <span style="color: #0000FF; font-weight: bold;">True</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUIGetMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$hMinimize</span>
			<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_MINIMIZE</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$hClose</span>
			<span style="color: #0000FF; font-weight: bold;">Exit</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span>	<span style="font-style: italic; color: #009933;">; Primary Down</span>
			<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SendMessage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">,</span>0x0112<span style="color: #FF0000; font-weight: bold;">,</span>0xF012<span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">WEnd</span></pre></div></div>

<p>In bucla principala ne intereseaza 3 evenimente: minimizare, inchidere si primary down (butonul principal al mouseului apasat &#8211; sa miscam fereastra). In consecinta cand este apasat butonul de minimizare (<span style="color: #800000;">$hMinimize</span>) se seteaza starea ferestrei <span style="color: #ff00ff;">@SW_MINIMIZE</span>; cand este apasat butonul de inchidere (<span style="color: #800000;">$hClose</span>) se inchide programul iar cand este interceptat mesajul <em>Primary Down</em> (valoarea <span style="color: #800080;">-7</span>) se apeleaza functia <span style="color: #0080ff;">_SendMessage</span> avand ca parametri: handle-ul ferestrei principale, mesajul <span style="color: #800000;">WM_SYSCOMMAND</span> (<span style="color: #800080;">0&#215;0112</span>) si <span style="color: #800000;">$SC_DRAGMOVE </span>(<span style="color: #800080;">0xF012</span>).</p>
<p>&nbsp;</p>
<p>Mai jos este partea cea mai importanta a tutorialului, functia care creaza interfata grafica:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Func</span> GUICreateEx<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sTitle</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iW</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iX</span><span style="color: #FF0000; font-weight: bold;">=-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iY</span><span style="color: #FF0000; font-weight: bold;">=-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$sBackground</span><span style="color: #FF0000; font-weight: bold;">=</span><span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$hGUI</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sTitle</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iW</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iY</span><span style="color: #FF0000; font-weight: bold;">,</span>0x80000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion1</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">100</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion2</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">99</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion3</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">300</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion4</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">105</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">195</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">35</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion5</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">105</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">35</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">145</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion6</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">155</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">35</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">195</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion3</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion6</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_SetWindowRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGUI</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #0000FF; font-weight: bold;">True</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$sBackground</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		<span style="font-weight: bold; color: #AA0000;">$hPic</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sBackground</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iW</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hPic</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">128</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$hTitle</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreateLabel</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sTitle</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">106</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">9</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">87</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span>0x01<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetFont</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hTitle</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">12</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">700</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Garamond&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetBkColor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hTitle</span><span style="color: #FF0000; font-weight: bold;">,</span>0x008000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetColor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hTitle</span><span style="color: #FF0000; font-weight: bold;">,</span>0x004040<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$hGUI</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>In prima linie din corpul functiei se creaza o fereastra cu toate specificatiile pasate ca parametri si se poate observa stilul <span style="color: #800000;">$WS_POPUP</span> (<span style="color: #800080;">0&#215;80000000</span>), folosit pentru ca nu ne intereseaza o fereastra cu o bara de titlu sau butoane sistem.</p>
<p>In urmatoarele linii cream 6 regiuni diferite care vor constitui interfata finala. Pentru acest lucru se folosesc functiile <a href="http://msdn.microsoft.com/en-us/library/ms908184.aspx" target="_blank"><span style="color: #0080ff;">_WinAPI_CreateRectRgn</span></a> si <a href="http://msdn.microsoft.com/en-us/library/dd183516%28v=vs.85%29.aspx" target="_blank"><span style="color: #0080ff;">_WinAPI_CreateRoundRectRgn</span></a>. Pentru a intelege mai bine partile care constituie interfata finala priviti imaginea de mai jos:</p>
<p><img class="aligncenter size-full wp-image-1210" title="Pic1" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic134.png" alt="" width="300" height="250" /></p>
<p>In urmatoarele linii de cod combinam (<a href="http://msdn.microsoft.com/en-us/library/ms928608.aspx" target="_blank"><span style="color: #0080ff;">_WinAPI_CombineRgn</span></a>) toate aceste regiuni intr-o singura regiune pe care o atribuim ferestrei (<a href="http://msdn.microsoft.com/en-us/library/aa453663.aspx" target="_blank"><span style="color: #0080ff;">_WinAPI_SetWindowRgn</span></a>) create pe prima linie.</p>
<p>Apoi se testeaza daca exista parametrul <span style="color: #800000;">$sBackground</span>, caz in care se creaza un control Pic si se seteaza o imagine de fundal. Controlul Pic care pastreaza imaginea de fundal se dezactiveaza pentru a nu se suprapune cu alte controale (<span style="color: #800000;">$GUI_DISABLE</span> <span style="color: #ff0000;">=</span> <span style="color: #800080;">128</span>). Apoi se mai creaza un control Label care va constitui titlul ferestrei. La acesta se seteaza fontul, culoare de fundal si culoarea textului.</p>
<p>In final se returneaza handle-ul ferestrei create pentru a putea fi folosit in continuare.</p>
<p>&nbsp;</p>
<p>Daca asamblati portiunile de cod de mai sus, obtineti scriptul:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #F000FF; font-style: italic;">#include</span><span style="font-style: italic; color: #9977BB;"> &lt;WinAPI.au3&gt;</span>	<span style="font-style: italic; color: #009933;">; Contine si SendMessage.au3</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$hMain</span> <span style="color: #FF0000; font-weight: bold;">=</span> GUICreateEx<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exemplu&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">300</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">250</span><span style="color: #FF0000; font-weight: bold;">,-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Background.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hMinimize</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Minimize.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">105</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">215</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="font-weight: bold; color: #AA0000;">$hClose</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Close.bmp&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">155</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">215</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">30</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_SHOW</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">While</span> <span style="color: #0000FF; font-weight: bold;">True</span>
	<span style="color: #0000FF; font-weight: bold;">Switch</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUIGetMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$hMinimize</span>
			<span style="color: #000080; font-style: italic; font-weight: bold;">GUISetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_MINIMIZE</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$hClose</span>
			<span style="color: #0000FF; font-weight: bold;">Exit</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">7</span>	<span style="font-style: italic; color: #009933;">; Primary Down</span>
			<span style="color: #0080FF; font-style: italic; font-weight: bold;">_SendMessage</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hMain</span><span style="color: #FF0000; font-weight: bold;">,</span>0x0112<span style="color: #FF0000; font-weight: bold;">,</span>0xF012<span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndSwitch</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">WEnd</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> GUICreateEx<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sTitle</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iW</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iX</span><span style="color: #FF0000; font-weight: bold;">=-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iY</span><span style="color: #FF0000; font-weight: bold;">=-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$sBackground</span><span style="color: #FF0000; font-weight: bold;">=</span><span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$hGUI</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICreate</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sTitle</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iW</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iX</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iY</span><span style="color: #FF0000; font-weight: bold;">,</span>0x80000000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion1</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">100</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion2</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">99</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">40</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion3</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">200</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">300</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion4</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">105</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">195</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">35</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion5</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">105</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">35</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">145</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$hRegion6</span> <span style="color: #FF0000; font-weight: bold;">=</span> _WinAPI_CreateRoundRectRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">155</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">35</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">195</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">-</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">5</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion2</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion3</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion4</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion5</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_CombineRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion6</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	_WinAPI_SetWindowRgn<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hGUI</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$hRegion1</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #0000FF; font-weight: bold;">True</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$sBackground</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
		<span style="font-weight: bold; color: #AA0000;">$hPic</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreatePic</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sBackground</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iW</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #AA0000;">$iH</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hPic</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">128</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">EndIf</span>
	<span style="color: #0000FF; font-weight: bold;">Local</span> <span style="font-weight: bold; color: #AA0000;">$hTitle</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlCreateLabel</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sTitle</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">106</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">9</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">87</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">20</span><span style="color: #FF0000; font-weight: bold;">,</span>0x01<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetFont</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hTitle</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">12</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">700</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Garamond&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetBkColor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hTitle</span><span style="color: #FF0000; font-weight: bold;">,</span>0x008000<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">GUICtrlSetColor</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$hTitle</span><span style="color: #FF0000; font-weight: bold;">,</span>0x004040<span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$hGUI</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Daca rulati scriptul, interfata grafica o sa fie asemanatoare cu cea de mai jos:</p>
<p><img class="aligncenter size-full wp-image-1214" title="Pic2" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic226.png" alt="" width="300" height="250" /></p>
<p>Restul tine de imaginatie si de preferinte. Puteti sa creati forme noi (elipse, poligoane, <a href="http://msdn.microsoft.com/en-us/library/dd162915%28v=VS.85%29.aspx" target="_blank">etc</a>), sa folositi culorile favorite, etc.</p>
<p>&nbsp;</p>
<p>Scriptul, resursele si o versiune compilata puteti descarca de <a href="http://download.autoitscript.ro/andy/CustomGUI.rar">aici</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/interfata-personalizata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Incarcarea medie a unui server</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/incarcarea-medie-a-unui-server/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/incarcarea-medie-a-unui-server/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 14:13:22 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1188</guid>
		<description><![CDATA[Daca folositi cPanel si vreti sa obtineti incarcarea medie a serverului dar nu aveti timpul necesar sa va logati, apoi sa verificati acest lucru atunci acest script o sa se dovedeasca foarte util. In acest tutorial vom invatat cum sa obtinem rapid informatii despre un server folosind cPanel XML API, in acest caz LoadAvg. &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Daca folositi cPanel si vreti sa obtineti incarcarea medie a serverului dar nu aveti timpul necesar sa va logati, apoi sa verificati acest lucru atunci acest script o sa se dovedeasca foarte util.</p>
<p>In acest tutorial vom invatat cum sa obtinem rapid informatii despre un server folosind cPanel XML API, in acest caz <a href="http://www.docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/LoadAvg" target="_blank">LoadAvg</a>.</p>
<p>&nbsp;</p>
<p>Incepem cu crearea unui script nou, in care primele linii vor fi urmatoarele:</p>
<p><img class="aligncenter size-full wp-image-1145" title="Pic1" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic133.png" alt="" width="488" height="175" /></p>
<p>&nbsp;</p>
<p>In prima linie includem fisierul antet <span style="color: #808080;">String.au3</span> de care avem nevoie pentru a putea accesa functia <span style="color: #0080ff;">_StringBetween</span>. Urmatoarele linii vor contine informatiile pentru conectare la server(credentialele), numele domeniului si numele API-ului. Exemplul de mai sus este un template, dumneavoastra trebuie sa modificati username-ul, parola si numele domeniului.</p>
<p>&nbsp;</p>
<p>Urmatoarele doua linii sunt folosite pentru a obtine, respectiv procesa informatiile obtinute.</p>
<p><img class="aligncenter size-full wp-image-1146" title="Pic2" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic225.png" alt="" width="487" height="51" /></p>
<p>Functia cPanel_XML_API efectueaza conectarea la server si obtine datele in format XML iar functia LoadAverage extrage datele din format XML si le pune intr-un array.</p>
<p>&nbsp;</p>
<p>Urmatoarele linii sunt folosite pentru a crea interfata grafica si main loop.</p>
<p><img class="aligncenter size-full wp-image-1152" title="Pic3" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic310.png" alt="" width="579" height="234" /></p>
<p>Codul scris pe linia 11, copiaza in directorul cu fisiere temporare un fisier bitmap care o sa fie folosit ca logo.</p>
<p>La linia 12 este creata fereastra principala.</p>
<p>La linia 13 se creaza un Pic control care afiseaza logo-ul.</p>
<p>Urmatoarele 3 linii (Label1..3) afiseaza timpul pentru care se afiseaza rezultatele, iar urmatoarele 3 linii (Value1..3) afiseaza rezultatele propriu-zise.</p>
<p>La linia 20 se seteaza starea vizibila pentru fereastra principala.</p>
<p>Liniile 22,23 si 24 constituie bucla principala, care verfica doar daca buton Close (x) este apasat.</p>
<p><em><span style="color: #ff0000;">Nota:</span> aceasta portiune de cod este optionala, daca doriti puteti afisa rezultatele si intr-un <span style="color: #000080;">MsgBox</span>.</em></p>
<p>&nbsp;</p>
<p>Codul de mai jos reprezinta functia cPanel_XML_API.</p>
<p><img class="aligncenter size-full wp-image-1178" title="Pic4" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic49.png" alt="" width="593" height="181" /></p>
<p>La linia 27 cream un obiect <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106%28v=vs.85%29.aspx" target="_blank">WinHTTPRequest</a>.</p>
<p>La linia 29 accesam metoda Open care deschide o conexiune HTTP la o resursa.</p>
<p>La linia 30 setam credentialele pentru conectare.</p>
<p>La linia 31 trimitem cererea.</p>
<p>La linia 33 obtinem raspunsul serverului, datele in format XML.</p>
<p>La linia 34 distrugem obiectul creat.</p>
<p>La linia 35 sunt returnate datele obtinute (inca in format XML).</p>
<p><em><span style="color: #ff0000;">Nota:</span> functia cPanel_XML_API nu este specifica pentru LoadAvg, cu ajutorul ei se pot accesa si alte API-uri.</em></p>
<p>&nbsp;</p>
<p>Codul de mai jos reprezinta functia LoadAverage.</p>
<p><img class="aligncenter size-full wp-image-1180" title="Pic5" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic59.png" alt="" width="588" height="184" /></p>
<p>La linia 39 obtinem sirul de caractere cuprinse intre stringurile <em>&lt;loadavg&gt;</em> si <em>&lt;/loadavg&gt;</em>. Rezultatul trebuie sa fie un array(vector).</p>
<p>La linia 40 se testeaza acest lucru.</p>
<p>La linia 41 se obtine valoarea incarcarii serverului pentru ultimul minut.</p>
<p>La linia 42 se obtine valoarea incarcarii serverului pentru ultimele 5 minute.</p>
<p>La linia 43 se obtine valoarea incarcarii serverului pentru ultimele 15 minute.</p>
<p>La linia 44 se returneaza rezultatul sub forma unui array. Am folosit functia <span style="color: #000080;">StringSplit</span> tocmai pentru a obtine un array din 3 stringuri.</p>
<p>La linia 46 se returneaza un mesaj de eroare in cazul in care rezultatul obtinut la linia 39 nu este sub forma unui array.</p>
<p><em><span style="color: #ff0000;">Nota:</span> nu am folosit un UDF (User Defined Function) pentru procesarea datelor XML pentru ca in acest caz aceasta metoda este mai eficienta din punct de vedere a liniilor de cod scrise si a dimensiunii scriptului compilat ca executabil.</em></p>
<p>&nbsp;</p>
<p>Daca asamblati toate portiunile de cod de mai sus, obtineti scriptul complet ca in imaginea de mai jos:</p>
<p><img class="aligncenter size-full wp-image-1182" title="Pic8" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic85.png" alt="" width="589" height="841" /></p>
<p>Daca modificati datele de conectare si rulati scriptul, obtineti o fereastra asemanatoare cu cea de mai jos:</p>
<p><img class="aligncenter size-full wp-image-1162" title="Pic7" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic73.png" alt="" width="131" height="154" /></p>
<p>Puteti descarca scriptul si resursele necesare de <a href="http://download.autoitscript.ro/andy/LoadAvg.rar">aici</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/incarcarea-medie-a-unui-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instalarea automata a utilitarului 7-Zip</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/auto-install-7-zip/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/auto-install-7-zip/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 14:11:48 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1186</guid>
		<description><![CDATA[Pentru inceput aveti nevoie de utilitarul 7-Zip pe care il puteti descarca de aici. Apoi trebuie sa creati un script nou (in exemplul meu i-am dat numele AutoInstall 7zip.au3), de preferat in acelasi director cu executabilul 7-Zip. Daca ati procedat dupa instructiuni trebuie sa aveti un director asemanator cu cel de mai jos: Apoi trebuie [...]]]></description>
			<content:encoded><![CDATA[<p>Pentru inceput aveti nevoie de utilitarul 7-Zip pe care il puteti descarca de <a href="http://downloads.sourceforge.net/sevenzip/7z920.exe" target="_blank">aici</a>. Apoi trebuie sa creati un script nou (in exemplul meu i-am dat numele AutoInstall 7zip.au3), de preferat in acelasi director cu executabilul 7-Zip. Daca ati procedat dupa instructiuni trebuie sa aveti un director asemanator cu cel de mai jos:</p>
<p><img class="aligncenter size-full wp-image-1108" title="Pic1" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic131.png" alt="" width="631" height="328" /></p>
<p>Apoi trebuie sa deschideti scriptul pentru editare. Prima linie din script este destinata rularii executabilului 7z920.exe si arata asa:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">Run</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;7z920.exe&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@ScriptDir</span></span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #800000; font-weight: bold;"><span style="font-weight: bold; color: #AA0000;">@SW_MINIMIZE</span></span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Aceasta linie va executa 7z920.exe, stiind ca directorul de lucru este directorul in care este plasat scriptul, cu optiunea ca va fereastra va fi in modul minimize.</p>
<p>&nbsp;</p>
<p>Apoi trebuie sa asteptam pana apare fereastra specifica procesului 7z920.exe. In acest caz fereastra se numeste &#8220;7-Zip 9.20 Setup &#8220;. Daca va intrebati cum am obtinut acest titlu pentru fereastra, raspunsul este folosind utilitarul AutoIt Window Info, pe care il gasiti Start-&gt; All Programs -&gt; AutoIt v3 sau in directorul AutoIt3 din Program Files.</p>
<p>Pentru a astepta fereastra, apelam functia <span style="color: #000080;">WinWait</span>:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">WinWait</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;7-Zip 9.20 Setup &quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;</p>
<p>Un exemlpu folosind utilitarul AutoIt Window Info:</p>
<p><img class="aligncenter size-full wp-image-1116" title="Pic2" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic224.png" alt="" width="538" height="547" /></p>
<p>&nbsp;</p>
<p>Daca dorim sa obtinem si directorul de instalare (in acest tutorial ne vom folosi de acest lucru) apelam functia <span style="color: #000080;">ControlGetText</span>, specificand numele ferestrei si controlul din care obtinem directorul de instalare, fara sa specificam textul ferestrei (in cele mai multe cazuri nici nu exista).</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$sPath</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">ControlGetText</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;7-Zip 9.20 Setup &quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Edit1&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;</p>
<p>Apoi trebuie sa apasam butonul Install pentru a incepe procesul de instalare. Acest lucru se face apeland functia <span style="color: #000080;">ControlClick</span>, avand aceeasi parametri ca si functia <span style="color: #000080;">ControlGetText</span>, doar ca in cazul acesta apasam <span style="color: #808080;">&#8220;Button2&#8243;</span> care este a doua instanta a clasei Button.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">ControlClick</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;7-Zip 9.20 Setup &quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Button2″)</span></pre></div></div>

<p>Modul de obtinere a claselor si instantele acestora dintr-o fereastra se face cum am mentionat anterior, folosind utilitarul AutoIt Window Info.</p>
<p><img class="aligncenter size-full wp-image-1118" title="Pic3" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic37.png" alt="" width="624" height="609" /></p>
<p>&nbsp;</p>
<p>Procesul de instalare poate varia ca durata, in functie de performantele sistemului, de aceea trebuie gasita o solutie prin care sa stim exact cand s-a finalizat procesul de instalare.</p>
<p>Pentru acest lucru vom crea o bucla in care vom verifica daca apare numele butonului de final.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Do</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">Sleep</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">10</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Until</span> <span style="color: #000080; font-style: italic; font-weight: bold;">ControlGetText</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;7-Zip 9.20 Setup &quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Button2&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #9977BB;">&quot;&amp;amp;Finish&quot;</span></pre></div></div>

<p>&nbsp;</p>
<p>La iesirea din bucla vom sti ca instalarea a ajuns la final. Tot ce mai trebuie sa facem este sa apasam butonul Finish.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">ControlClick</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;7-Zip 9.20 Setup &quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Button2″)</span></pre></div></div>

<p>&nbsp;</p>
<p>Dupa ce este apasat butonul Finish, poate doriti sa informati utilizatorul ca instalarea a fost efectuata si sa intrebati daca doreste deschidere directorului de instalare.</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$Question</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">MsgBox</span><span style="color: #FF0000; font-weight: bold;">&#40;</span>0x44<span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Mesaj&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="font-weight: bold; color: #9977BB;">&quot;Instalare cu succes.&quot;</span> <span style="color: #FF0000; font-weight: bold;">&amp;</span>amp<span style="font-style: italic; color: #009933;">; @CRLF &amp;amp; _</span>
<span style="font-weight: bold; color: #9977BB;">&quot;Doriti deschiderea directorului de instalare?&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>&nbsp;</p>
<p>Mai trebuie doar tratat raspunsul utilizatorului:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">If</span> <span style="font-weight: bold; color: #AA0000;">$Question</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">6</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
	<span style="color: #000080; font-style: italic; font-weight: bold;">ShellExecute</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sPath</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">Else</span>
	<span style="color: #0000FF; font-weight: bold;">Exit</span>
<span style="color: #0000FF; font-weight: bold;">EndIf</span></pre></div></div>

<p>&nbsp;</p>
<p>Daca asamblati toate liniile de cod de mai sus, scriptul va arata asa:</p>
<p><img class="aligncenter size-full wp-image-1123" title="Pic4" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic47.png" alt="" width="614" height="593" /></p>
<p>&nbsp;</p>
<p>Daca rulati scriptul, la final de instalare va aparea mesajul:</p>
<p><img class="aligncenter size-full wp-image-1138" title="Pic5" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic57.png" alt="" width="281" height="126" /></p>
<p>Daca raspunsul este Yes se va deschide directorul de instalare (ca si in exemplul de mai jos) apoi scriptul se inchie, iar daca raspunsul este No atunci scriptul se incheie.</p>
<p><img class="aligncenter size-full wp-image-1139" title="Pic6" src="http://www.autoitscript.ro/wp-content/uploads/2011/11/Pic67.png" alt="" width="675" height="531" /></p>
<p>Puteti descarca de <a href="http://download.autoitscript.ro/andy/7zip.rar">aici</a> scriptul si executabilul utilitarului 7-Zip.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/auto-install-7-zip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>System tray</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/system-tray/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/system-tray/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 22:24:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=869</guid>
		<description><![CDATA[In AutoIt se poat face multe tipuri de aplicatii, limbajul fiind suficient pentru majoritatea aplicatiilor pe care un programator le poate face pentru uz propriu sau pentru un grup restrans de oameni. De exemplu, in AutoIt se pot crea usor si rapid aplicatii care verifica disponibilitatea unui serviciu sau aplicatii care ruleaza taskuri administrative cum [...]]]></description>
			<content:encoded><![CDATA[<p>In <strong>AutoIt</strong> se poat face multe tipuri de aplicatii, limbajul fiind suficient pentru majoritatea aplicatiilor pe care un programator le poate face pentru uz propriu sau pentru un grup restrans de oameni. De exemplu, in AutoIt se pot crea usor si rapid aplicatii care verifica disponibilitatea unui serviciu sau aplicatii care ruleaza taskuri administrative cum ar fi crearea de copii de siguranta sau stergerea fisierelor temporare. Pentru taskuri de acest gen e foarte util ca aplicatia sa ruleze in <strong>System Tray</strong>, de unde o putem apela rapid.</p>
<p>Pentru a lucra cu <strong>System Tray</strong> avem nevoie de functiile <em>TrayCreateItem()</em>, <em>TrayGetMsg()</em> si <em>TraySetState()</em>. Cu <em>TrayCreateItem()</em> vom crea elementele unui meniu care va apare cand dam click pe iconita din <strong>System Tray</strong>. <em>TrayGetMsg()</em> ne va spune pe care element al meniului am dat click iar cu <em>TraySetState()</em> vom pastra iconita in <strong>System Tray</strong> (<em>optional, o putem ascunde sau o putem face sa apara si sa dispara intermitent</em>).</p>
<p>Un exemplu de aplicatie care ruleaza in <strong>System Tray</strong> avem mai jos:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">Opt</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;TrayMenuMode&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$action</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">TrayCreateItem</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Click me! Click me!&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">TrayCreateItem</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="font-weight: bold; color: #AA0000;">$exit</span>   <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">TrayCreateItem</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exit&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">TraySetIcon</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;warning&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">TraySetToolTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Click aici!&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">TraySetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">While</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
	<span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">TrayGetMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Select</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span>
			<span style="color: #0000FF; font-weight: bold;">ContinueLoop</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$action</span>
			<span style="color: #000080; font-style: italic; font-weight: bold;">MsgBox</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;Click!&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;Ai clickuit :-)&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$exit</span>
			<span style="color: #0000FF; font-weight: bold;">ExitLoop</span>
	<span style="color: #0000FF; font-weight: bold;">EndSelect</span>
<span style="color: #0000FF; font-weight: bold;">WEnd</span></pre></div></div>

<p>Cu <em>TrayCreateItem()</em> am creat doua elemente ale meniului, <em>$action</em> si <em>$exit</em>, fiecare cu un text propriu. Am folosit <em>TraySetIcon()</em> pentru a pune o iconita personalizata si <em>TraySetToolTip()</em> pentru a crea un tooltip cand suntem cu mouseul deasupra iconitei, dar aceste functii nu sunt necesare. Cu <em>TraySetState(1);</em> i-am spus interpretorului ca iconita trebuie afisata &#8211; daca parametrul functiei era <strong>2</strong> iconita disparea iar daca era <strong>4</strong> iconita aparea si disparea intermitent.</p>
<p>In bucla <strong>While</strong> citim rezultatul functiei <em>TrayGetMsg()</em> care ne spune care element al meniului a fost actionat, iar folosind <strong>Case</strong> putem initia diverse actiuni in functie de elementul selectat din meniu.</p>
<p>Ca sa ne amuzam putin putem scrie urmatorul cod:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">Opt</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;TrayMenuMode&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
&nbsp;
<span style="font-weight: bold; color: #AA0000;">$shutdown</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">TrayCreateItem</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Shut down&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="font-weight: bold; color: #AA0000;">$logout</span>   <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">TrayCreateItem</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Log out&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">TrayCreateItem</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="font-weight: bold; color: #AA0000;">$exit</span>     <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">TrayCreateItem</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Exit&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">TraySetIcon</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;warning&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">TraySetToolTip</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #9977BB;">&quot;Click aici!&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">TraySetState</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">While</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
	<span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">TrayGetMsg</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Select</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span>
			<span style="color: #0000FF; font-weight: bold;">ContinueLoop</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$shutdown</span>
			<span style="color: #000080; font-style: italic; font-weight: bold;">Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$logout</span>
			<span style="color: #000080; font-style: italic; font-weight: bold;">Shutdown</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span>
		<span style="color: #0000FF; font-weight: bold;">Case</span> <span style="font-weight: bold; color: #AA0000;">$msg</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="font-weight: bold; color: #AA0000;">$exit</span>
			<span style="color: #0000FF; font-weight: bold;">ExitLoop</span>
	<span style="color: #0000FF; font-weight: bold;">EndSelect</span>
<span style="color: #0000FF; font-weight: bold;">WEnd</span></pre></div></div>

<p>Acum vom avea trei elemente in meniu: &#8220;<em>Shut down</em>&#8220;, &#8220;<em>Log out</em>&#8221; si &#8220;<em>Exit</em>&#8220;. Elementul &#8220;<em>Exit</em>&#8221; e la fel ca in varianta anterioara. Diferenta apara la cele doua elemente, &#8220;<em>Shut down</em>&#8221; si &#8220;<em>Log out</em>&#8220;, care la click vor apela functia <a href="http://www.autoitscript.com/autoit3/docs/functions/Shutdown.htm" title="Shutdown" rel="nofollow">Shutdown()</a> cu parametrul <strong>1</strong> pentru oprirea sistemului respectiv <strong>0</strong> pentru deautentificare.</p>
<p>Daca doriti sa testati al doilea cod, nu uitati sa salvati orice fisier deschis pentru ca toata informatia nesalvata va fi pierduta <img src='http://www.autoitscript.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/system-tray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://www.autoitscript.ro/tutorial-autoit/hello-world/</link>
		<comments>http://www.autoitscript.ro/tutorial-autoit/hello-world/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 11:54:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.autoitscript.ro/?p=1</guid>
		<description><![CDATA[Ca in orice alt limbaj, si in AutoIt e bine sa incepem cu afisarea unui text simplu: &#8220;Hello, world!&#8220;. Chiar daca nu are o utilitate deosebita ne va ajuta sa vedem cum se creaza un script simplu in AutoIt, cum putem afisa un mesaj si cum putem compila un script pentru a-l transforma intr-un executabil [...]]]></description>
			<content:encoded><![CDATA[<p>Ca in orice alt limbaj, si in AutoIt e bine sa incepem cu afisarea unui text simplu: &#8220;<strong>Hello, world!</strong>&#8220;. Chiar daca nu are o utilitate deosebita ne va ajuta sa vedem cum se creaza un script simplu in AutoIt, cum putem afisa un mesaj si cum putem compila un script pentru a-l transforma intr-un executabil (<em>.exe</em>). Pentru a pune tutorialul in practica trebuie sa aveti instalate <a href="http://www.autoitscript.ro/descarcare-si-instalare/" title="Descarcare si instalare AutoIt si SciTE4AutoIt">AutoIt si SciTE4AutoIt</a>.</p>
<p>Pentru inceput vom crea un fisier intr-un folder oarecare si ii vom da un nume sugestiv (<em>ex. HelloWorld.au3</em>):<br />
<a href="http://www.autoitscript.ro/wp-content/uploads/2011/10/create.png"><img src="http://www.autoitscript.ro/wp-content/uploads/2011/10/create-490x367.png" alt="" title="Creaza fisier au3" width="490" height="367" class="aligncenter size-medium wp-image-861" /></a></p>
<p>Fisier pe care il vom edita folosind <strong>SciTE4AutoIt</strong>:<br />
<a href="http://www.autoitscript.ro/wp-content/uploads/2011/10/edit-script.png"><img src="http://www.autoitscript.ro/wp-content/uploads/2011/10/edit-script-490x367.png" alt="" title="edit-script" width="490" height="367" class="aligncenter size-medium wp-image-862" /></a></p>
<p>Editorul va introduce automat urmatoarele linii:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-style: italic; color: #669900;">#cs ----------------------------------------------------------------------------
&nbsp;
 AutoIt Version: 3.3.6.1
 Author:         myName
&nbsp;
 Script Function:
	Template AutoIt script.
&nbsp;
#ce</span> <span style="color: #FF0000; font-weight: bold;">----------------------------------------------------------------------------</span>
&nbsp;
<span style="font-style: italic; color: #009933;">; Script Start - Add your code below here</span></pre></div></div>

<p>Sunt comentarii pe care le putem sterge sau le putem modifica dupa bunul plac. Pentru a afisa mesajul &#8220;<strong>Hello, world!</strong>&#8221; vom adauga imediat dupa comentarii urmatoarea linie:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="color: #000080; font-style: italic; font-weight: bold;">MsgBox</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;Titlu&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;Hello, world!&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="font-style: italic; color: #009933;">;</span></pre></div></div>

<p>Salvam fisierul (<em>Ctrl+S</em>) si il rulam (<em>F5</em>). Rezultatul va fi o fereastra mica cu un buton &#8220;<em>OK</em>&#8220;, generata de functia <a href="http://www.autoitscript.ro/interactiunea-cu-scriptul/" title="Message Box in AutoIt">MsgBox</a>, fereastra care ne va afisa mesajul: &#8220;<strong>Hello, world!</strong>&#8220;.<br />
<a href="http://www.autoitscript.ro/wp-content/uploads/2011/10/rezultat.png"><img src="http://www.autoitscript.ro/wp-content/uploads/2011/10/rezultat-490x367.png" alt="" title="rezultat" width="490" height="367" class="aligncenter size-medium wp-image-863" /></a></p>
<p>Observam ca al doilea parametru al functie <strong>MsgBox</strong>, &#8220;<em>Titlu</em>&#8220;, este textul care apare in titlul ferestrei generate iar al treilea parametru, &#8220;<em>Hello, world!</em>&#8221; este textul afisat in fereastra. Primul parametru <a href="http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm" rel="nofollow" title="MsgBox">poate fi modificat</a> daca dorim si alte butoane in afara de &#8220;<em>OK</em>&#8221; &#8211; de exemplu 1 pentru &#8220;<em>OK</em>&#8221; si &#8220;<em>Cancel</em>&#8220;.</p>
<p>Urmatorul pas ar fi compilarea scriptului pentru a avea un fisier executabil. In fereastra <em>SciTE4AutoIt</em> apasam <em>Ctrl+F7</em>. Se deschide o fereastra in care putem modifica parametri de compilare:<br />
<a href="http://www.autoitscript.ro/wp-content/uploads/2011/10/compilare.png"><img src="http://www.autoitscript.ro/wp-content/uploads/2011/10/compilare-490x398.png" alt="" title="compilare" width="490" height="398" class="aligncenter size-medium wp-image-864" /></a></p>
<p>Odata ce apasam &#8220;<em>Compile Script</em>&#8221; se va genera un fisier executabil pe care il putem rula:<br />
<a href="http://www.autoitscript.ro/wp-content/uploads/2011/10/executabil.png"><img src="http://www.autoitscript.ro/wp-content/uploads/2011/10/executabil-490x367.png" alt="" title="executabil" width="490" height="367" class="aligncenter size-medium wp-image-865" /></a></p>
<p>Acum ca am scris prima aplicatie in AutoIt, am invatat cateva lucruri noi:</p>
<ul>
<li>de ce avem nevoie pentru a programa in AutoIt;</li>
<li>cum se creaza si modifica un script;</li>
<li>cum se adauga comentarii in AutoIt;</li>
<li>cum afisam un mesaj in AutoIt;</li>
<li>cum rulam si compilam un script facut in AutoIt.</li>
</ul>
<p>Acum ne mai trebuie doar idei de programe pe care sa le scriem in AutoIt <img src='http://www.autoitscript.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.autoitscript.ro/tutorial-autoit/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Object Caching 447/604 objects using memcached

Served from: autoitscript.ro @ 2012-05-19 20:34:38 -->
