background preloader

Section 3

Facebook Twitter

Free Pascal - Online documentation. Lazarus Development. On the road with Lazarus/Freepascal. Executing External Programs. SysUtils.ExecuteProcess The simplest way if you don't need pipes or any form of control is to simply use SysUtils .

Executing External Programs

ExecuteProcess ( UTF8ToSys ( '/full/path/to/binary' ) , '' , [ ] ) ; For simplicity's sake, the calling process runs synchronously: it 'hangs' until the external program has finished. For more complex forms, see the next section about TProcess. ExecuteProcess reference Windows CreateProcess, ShellExecute and WinExec If you always use and/or in Delphi, then you can begin to use TProcess as an alternative in FPC/Lazarus (this is valid too if you are running Lazarus in Linux, because TProcess is cross-platform). While FPC/Lazarus has support for , and/or , this support is only in Win32/64. WinExec is a 16-bit call that has been deprecated for years in the Windows API. Unix fpsystem, fpexecve and shell These functions are platform dependent. fpsystem reference fpexecve reference shell reference Note that the 1.0.x ' has been deprecated for a while, and is removed in trunk. TProcess. How To Write Lazarus Component.

Introduction This is a basic guide on how to build components. It was tested on Windows 7 running Lazarus 0.9.30. Step 1: Create The Package On the Lazarus IDE menu, click to run the Package Manager. A file will appear. Congratulations: You have just created your first package! Step 2: Creating The Unit You can create a new unit or use an existing file. Create a New Unit Use the . Choose a component like TComboBox. Choose as filename. Click OK. unit CustomControl1 ; {$mode objfpc}{$H+} interface uses Classes , SysUtils , LResources , Forms , Controls , Graphics , Dialogs , StdCtrls ; type TCustomControl1 = class ( TComboBox ) private { Private declarations } protected { Protected declarations } public { Public declarations } published { Published declarations } end ; procedure Register ; implementation procedure Register ; begin RegisterComponents ( 'Standard' , [ TCustomControl1 ] ) ; end ; end .

Install the package by clicking the 'install' button at the top of the package editor. Adventures of a Newbie. English (en) | Français (fr) | 日本語 (ja) | ‪中文(中国大陆)‬ (zh_CN) Warning: As indicated by the writer, this article was written by a newbie who may not have known the best way of doing things.

Adventures of a Newbie

The code and solutions presented may very well not be optimal. Please be aware of this and verify solutions with other documentation; please add links to articles with improved code/solutions. However, having the thought processes of a new user described could be quite valuable for others in the same situation Note: This article was originally written years ago and a lot of things have changed/improved since then. I'm writing this because like you I'm a newbie (as of today only five days under my belt).

Getting started Installation I am using SUSE 10.0. So before downloading the FPC (Free Pascal Compiler) and Lazarus IDE files you should install the development graphic libraries. As of today there are two versions of FPC. So, I downloaded the latest binaries of FPC and Lazarus. Starting the IDE John Fabiani. Living Lazarus. Porting to Lazarus. Parallel Pascal Worlds. Pascal - SwinBrain. From SwinBrain Pascal is the name of a general purpose procedural programming language.

Pascal - SwinBrain

Hello World in Pascal The classic programming example, used as a first trial. Say hello to programming with Pascal. program HelloWorld; begin WriteLn('Hello World'); end. This can be simplified to just: begin WriteLn('Hello World'); end. Variable declaration: This shows variable declaration and use in Pascal. program SillyName; { This program displays different messages based upon a name that is entered by the user. }var name : String; //The name of the user running the programbegin Write('Please enter your name: '); ReadLn(name); if name = 'Fred' then begin WriteLn('What a nice name'); end else begin WriteLn('Well that is a silly name'); end; end.

Pascal Development Tools Various Pascal compilers are available for different systems. See our wiki page on Free Pascal Compiler Visit the official FPC web site at www.freepascal.org You can also download the Turbo Delphi IDE from Borland.