1. About.com
  2. Computing & Technology
  3. Delphi

Threading and Thread Pools Made Easy!

Threading in Delphi

The time has come for you to start implementing multi-threaded code in your Delphi applications? To speed up some parts of the application you might want to decide to add several simultaneous paths of execution in your Delphi application.

Threading 101
Delphi Spotlight10

Run Your Delphi Application in Full Screen - Implement "F11 - Full Screen"

Monday February 13, 2012
in Delphi TIPS :: I guess you know you can run your browser in full screen using the F11 shortcut key. Windows Explorer also supports this feature.

Running in full screen, where an application UI covers the entire screen, over the TaskBar and any Desktop/Tool bars, is handy when a user has a limited screen size (netbooks) or when you just want more to be visible by the browser or the Windows Explorer.

Read the full article to learn how to Run Your Delphi Application in Full Screen - Over the Windows TaskBar and Other Desktop/Tool Bars

Related:

How Do You Delete Dataset Records In a Loop?

Tuesday February 7, 2012
in Delphi Database Development :: I guess that all Delphi developers have tried, at least once, doing some database development. When creating database applications you'll need to pick the right database for your needs, you need to pick the right set of Delphi components to connect to the database and finally you need to know how and what controls to use to create the user interface for the application.

All clear. Now, let's suppose that you have some application where your task is to delete all the records from a dataset based on some criteria. Never mind what database, never mind what controls you are using, just imagine a scenario where you iterate through the records of a dataset and delete the row if it meets some criteria.

For the sake of simplicity, let's suppose that no database referential integrity or something similar stops you from deleting a row of data. In other words, if a row needs to be deleted it will get deleted (never mind the origin of the data in the dataset). Also, you cannot use a simple SQL statement like "Delete FROM ... WHERE".

Now, here's what the code might look:


var
  ds : TSomeDataSet
begin
  ds.First;
  while NOT ds.Eof do
  begin
    if TRUE then ds.Delete;
	
    ds.Next;
  end;
end;
A simple iteration going through all the records in a dataset (named "ds"), where if some criteria is met ("if true then") the row gets deleted.

Now, here's a question for you: how many records (in %) would get deleted by the above code?

Related:

Free PDF Library for Delphi Developers - Quick PDF Library LITE

Monday February 6, 2012
in Delphi and PDF :: Are you developing a Delphi application with a task to do PDF document manipulations? Portable Document Format, PDF, is a file format created by Adobe for document exchange. While there are many (commercial) Delphi libraries designed to help you create PDF and/or manipulate PDF documents, if you *only* need to load an existing PDF document, get the information from it (number of pages, security, is it linearized) and even write some information to it (set page size, add text, add graphics), you might want to take a look at the Quick PDF Library - LITE version.

Quick PDF Library Lite offers a subset of the functionality found in Quick PDF Library -- a royalty-free PDF developer SDK - for free!

What's more: Quick PDF Library Lite is available as an ActiveX component and works with C, C++, C#, Delphi, PHP, Visual Basic, VB.NET, ASP, PowerBASIC, Pascal or any other language that supports ActiveX.

Here's a short list of the supported functions in Quick PDF Library Lite (names would give you the clue of the actual usage): AddImageFromFile, AddLinkToWeb, AddStandardFont, DocumentCount, DrawImage, DrawText, FindImages, GetInformation, HasFontResources, ImageCount, ImageHeight, ImageWidth, Linearized, LoadFromFile, NewDocument, NewPage, PageCount, PageHeight, PageRotation, PageWidth, RemoveDocument, SaveToFile, SecurityInfo, SelectDocument, SelectedDocument, SelectFont, SelectImage, SelectPage, SetInformation, SetOrigin, SetPageSize, SetPageDimensions, SetTextAlign, SetTextColor, SetTextSize.

Note: the Lite version of Quick PDF Library comes as an ActiveX component. You need to register the ActiveX library with Windows, using the following command:

regsvr32 \QuickPDFLite0719.dll

Next, here's a simple usage example:


uses
 ComObj;
procedure TForm1.Button1Click(Sender: TObject);
var
 QP: Variant;
begin
 QP := CreateOleObject('QuickPDFLite0719.PDFLibrary');
 QP.DrawText(100, 500, 'Hello World!');
 QP.SaveToFile('c:\test.pdf');
 QP := Unassigned;
end;

Related:

Switch Languages / Keyboard Layouts in Your Delphi Application

Friday February 3, 2012
in Delphi TIPS :: If you need to allow the user of your Delphi application to use different languages / keyboard layouts to input data, you would need to mimic the "Text Service and Input Languages" Control Panel applet.

Using Control Panel you can specify the default language that you use to insert text. The default language is used every time you start or log on to your computer. For example, if you insert text in German most of the time, but have also added English as an input language, select German as your default language. When you want to insert text in English, you can switch to that language.

Read the full article to learn how to Programmatically Activate Keyboard Layout / Input Identifier

Related:

Discuss in my forum

©2012 About.com. All rights reserved. 

A part of The New York Times Company.