Sand Box/ru

From Lazarus wiki
Revision as of 11:56, 7 December 2014 by Alexrus (talk | contribs)
Jump to navigationJump to search

Deutsch (de) English (en) español (es) Bahasa Indonesia (id) italiano (it) 日本語 (ja) polski (pl) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN)

Заголовок


Подзаголовок

 Program Test;
 Uses Crt;

 Var I : Integer;

 Begin
   For I := 0 to 12 do
     WriteLn('Test ',I:2);
 End.

--Graeme 11:03, 23 March 2012 (UTC) The DELPHI style doesn't seem to be supported, so we have to use the SOURCE tag instead.

Ссылки внутри статьи

Как использовать внутреннюю ссылку: Отступ первой строки.

Внешняя ссылка

Внешняя ссылка: Название ссылки
Ещё одна ссылка: Название ссылки

Изображение

This text should be placed near the picture, does it? zxvzxcv zxvc xcv xzcv zxcv zxvc zxvc zxcv zxcv zxcv zxcv xcv xcv xcv xcv zxcv zxcv zxcv xcv zxcv zxcv aaaaaaaaaaaaa
And this line were is going? and this line?

Текст

Это текст

Новая секция

Таблица 2

Заголовок 1 Заголовок 2 Заголовок 3 Заголовок 4
Элемент 1,1 Элемент 1,2 Элемент 1,3 Элемент 1,4
Элемент 2,1 Элемент 2,2 Элемент 2,3 Элемент 2,4

Маркированный список

  • Один
  • Два
    • Три

Нумерованный список

  1. Первый
  2. Второй
  3. Третий

Вложенная нумерация

  1. Первый
    1. Первый.Один
    2. Первый.Два
    3. Первый.Три
  2. Второй
    1. Второй.Один
    2. Второй.Два
    3. Второй.Три

Смешанная нумерация

  1. Первый
    • Первый.Один
    • Первый.Два
    • Первый.Три
  2. Второй
    • Второй.Один
    • Второй.Два
    • Второй.Три

Отступ первой строки

      Please note that all contributions to Lazarus-ccr are considered to be released under the GNU Free Documentation License (see Lazarus-ccr:Copyrights for details). If you don't want your writing to be edited mercilessly and redistributed at will, then don't submit it here.

You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION!

ТЕСТ

es:Probando

Another Test: lets go crazy

I want to create a boxed text:

This is in a box, or so I hope.

This is outside the box, no? And this is a reference to my incomplete Structural Analyis book ThisIsMyShura

Weird: this is in the box as well?
  • And a bullet in italics?

non formatted...

Humm

Float Like A Butterfly

New section?

Let's see... ok

grusskarte

if Graphviz was installed, this would draw a pretty graph...

<graphviz> digraph G {

 rankdir=LR; node [fontsize = "8" shape = "rectangle"]; 
 "Node 1" -> "Node 2";

} </graphviz>

This is a test to see, if I can edit a page after the Bad-Behavior update. fpcfan 22:43, 7 December 2007 (CET)

Ссылки на туториалы

30 Second Quick Wiki Tutorial

Use this syntax to include a page within another page: {{:LazAutoUpdater}} Deutsch (de) English (en) español (es) Bahasa Indonesia (id) italiano (it) 日本語 (ja) polski (pl) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN)

Test whether an Application is already running

Here's a unit that works under both Windows and Linux

  • There's no need to pass the full application path to the function - the ExeName will usually do. Below code cannot find out its own exename though.
unit uappisrunning;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils
  {$IFDEF WINDOWS}, Windows, JwaTlHelp32{$ENDIF}
  {$IFDEF LINUX},process{$ENDIF};
// JwaTlHelp32 is in fpc\packages\winunits-jedi\src\jwatlhelp32.pas

// Returns TRUE if EXEName is running under Windows or Linux
// Don't pass an .exe extension to Linux!
function AppIsRunning(const ExeName: string):Boolean;

implementation

// These functions return Zero if app is NOT running
// Override them if you have a better implementation

{$IFDEF WINDOWS}
function WindowsAppIsRunning(const ExeName: string): integer;
var
  ContinueLoop: BOOL;
  FSnapshotHandle: THandle;
  FProcessEntry32: TProcessEntry32;

begin
  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
  Result := 0;

  while integer(ContinueLoop) <> 0 do
    begin
    if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
      UpperCase(ExeName)) or (UpperCase(FProcessEntry32.szExeFile) =
      UpperCase(ExeName))) then
      begin
      Inc(Result);
      // SendMessage(Exit-Message) possible?
      end;
    ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
    end;

  CloseHandle(FSnapshotHandle);
end;
{$ENDIF}

{$IFDEF LINUX}
function LinuxAppIsRunning(const ExeName: string): integer;
var
  t: TProcess;
  s: TStringList;

begin
  Result := 0;
  t := tprocess.Create(nil);
  t.CommandLine := 'ps -C ' + ExeName;
  t.Options := [poUsePipes, poWaitonexit];

    try
    t.Execute;
    s := TStringList.Create;
      try
      s.LoadFromStream(t.Output);
      Result := Pos(ExeName, s.Text);
      finally
      s.Free;
      end;
    finally
    t.Free;
    end;

end;
{$ENDIF}

function AppIsRunning(const ExeName: string):Boolean;
begin

{$IFDEF WINDOWS}
  Result:=(WindowsAppIsRunning(ExeName) > 0);
{$ENDIF}

{$IFDEF LINUX}
  Result:=(LinuxAppIsRunning(ExeName) > 0);
{$ENDIF}

end;
end.

See also