Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Delphi

Iniciar proteção de tela | Start screen saver

SendMessage(Application.Handle, WM_SYSCOMMAND, SC_SCREENSAVE, 0);
https://snipt.net/embed/19861e303695ae4979d6693fff7125e3/
https://snipt.net/raw/19861e303695ae4979d6693fff7125e3/
19861e303695ae4979d6693fff7125e3
delphi
Delphi
1
2016-12-02T18:24:54
True
False
False
/api/public/snipt/19993/
iniciar-protecao-de-tela-start-screen-saver
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">SendMessage</span><span class="p">(</span><span class="n">Application</span><span class="o">.</span><span class="n">Handle</span><span class="o">,</span> <span class="n">WM_SYSCOMMAND</span><span class="o">,</span> <span class="n">SC_SCREENSAVE</span><span class="o">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">;</span> </span></pre></div> </td></tr></table>
codegear, delphi

Delphi

Fechar aplicação | Close application

Application.Terminate;
https://snipt.net/embed/08dd64e9781305debc4339b745f1b18c/
https://snipt.net/raw/08dd64e9781305debc4339b745f1b18c/
08dd64e9781305debc4339b745f1b18c
delphi
Delphi
1
2016-12-02T18:24:59
True
False
False
/api/public/snipt/19991/
fechar-aplicacao-close-application
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">Application</span><span class="o">.</span><span class="n">Terminate</span><span class="o">;</span> </span></pre></div> </td></tr></table>
codegear, delphi

Delphi

Tocar som WAV | Play WAV sound

1
2
3
// Adiciona mmSystem em Uses | Add mmSystem to your Uses clause

SndPlaySound('som.wav', SND_ASYNC);
https://snipt.net/embed/ba74965fbe5458b69926332c2a220d71/
https://snipt.net/raw/ba74965fbe5458b69926332c2a220d71/
ba74965fbe5458b69926332c2a220d71
delphi
Delphi
3
2016-12-02T18:25:00
True
False
False
/api/public/snipt/19990/
tocar-som-wav-play-wav-sound
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">// Adiciona mmSystem em Uses | Add mmSystem to your Uses clause</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="n">SndPlaySound</span><span class="p">(</span><span class="s">&#39;som.wav&#39;</span><span class="o">,</span> <span class="n">SND_ASYNC</span><span class="p">)</span><span class="o">;</span> </span></pre></div> </td></tr></table>
codegear, delphi

Delphi

Delphi_GetParentDirectory

1
2
3
4
5
6
7
//returns the parent directory for the
//provided "path" (file or directory)

function GetParentDirectory(path : string) : string;
begin
  result := ExpandFileName(path + '\..')
end;
https://snipt.net/embed/ba0a8a31d0ad5bce5503963ca2a75a84/
https://snipt.net/raw/ba0a8a31d0ad5bce5503963ca2a75a84/
ba0a8a31d0ad5bce5503963ca2a75a84
delphi
Delphi
7
2016-12-03T20:26:30
True
False
False
/api/public/snipt/9238/
delphi_getparentdirectory
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">//returns the parent directory for the</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">//provided &quot;path&quot; (file or directory)</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="k">function</span> <span class="nf">GetParentDirectory</span><span class="p">(</span><span class="n">path</span> <span class="o">:</span> <span class="k">string</span><span class="p">)</span> <span class="o">:</span> <span class="k">string</span><span class="o">;</span> </span><span id="L-5"><a name="L-5"></a><span class="k">begin</span> </span><span id="L-6"><a name="L-6"></a> <span class="bp">result</span> <span class="o">:=</span> <span class="nb">ExpandFileName</span><span class="p">(</span><span class="n">path</span> <span class="o">+</span> <span class="s">&#39;\..&#39;</span><span class="p">)</span> </span><span id="L-7"><a name="L-7"></a><span class="k">end</span><span class="o">;</span> </span></pre></div> </td></tr></table>
delphi, directory, file, parent

Delphi

Hello snipt!

ShowMessage('Hello snipt!');
https://snipt.net/embed/5d0c2a3f60d8c8d648dff2e794fc666d/
https://snipt.net/raw/5d0c2a3f60d8c8d648dff2e794fc666d/
5d0c2a3f60d8c8d648dff2e794fc666d
delphi
Delphi
1
2016-12-02T13:54:26
True
False
False
/api/public/snipt/3768/
hello-snipt
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">ShowMessage</span><span class="p">(</span><span class="s">&#39;Hello snipt!&#39;</span><span class="p">)</span><span class="o">;</span> </span></pre></div> </td></tr></table>
delphi, hello, message, pascal, show, showmessage, snipt
Copyrighted, illegal, or inappropriate content? Email [email protected].