How to download/grap web pages or XML document at internet website in Delphi XE? If you are considering Delphi XE as cross compiler for the multiple platforms such as Android, iOS, and Windows, you need to have the standard method to get web content such as the normal text, or XML document as a result of RESTful API.Delphi provides the... |
Run command with Administrator permission in Delphi on Microsoft Windows In Delphi, you can execute commands with administrator privileges by using the ShellExecute function with the 'runas' verb. However, if you want to execute a specific command with administrator privileges, you can use the CreateProcess function from the Wi... |
How to get application version number in Delphi If you need to get application version number at runtime, you can get it by calling below sample code. |
Delphi Program can command level execution program with hidden mode Below is the example of running command with hidden mode. Actually there lots of command type in Windows like SW_NORMAL, SW_HIDE, ...What I am going to implement is running windows command with hidden mode.Below is the example of windows command execution ... |
Get the length of arrays and a string The length function returns either the number of characters in Source String, or the number of elements in Source Array.Notes: Arrays start at index=0 by default, So the length of such an array is 1 more than the highest index.Following is the simple examp... |
How to return exit code such as exit() function in C/C++ ? You can return exit code in delphi by following method: As you can see above, you can set exit code by ExitCode variable. That is global variable indicating exit code. |
How to send text/html based email in UTF-8 with TIdSMTP, TIdMessage VCL I had problem in encoding mail header with IdSMTP, IdMessage. I found some references in Internet, but the problem is the delivered mail subject is always filled with question marks except english letters.I found the answer to clear the problem. Here's the... |
Show *any* graphics as Glyph on a SpeedButton TBitBtn and TSpeedButton accept only BMP pictures, if you have some other picture format, like ICO or JPG, (in an Image component) you want to show as a Glyph, you'll need to "transform" it to Bitmap, here's how: |
Good Delphi components JVCL source code that can be obtained from http://jvcl.sourceforge.net JCL source code that can be obtained from http://jcl.sourceforge.net Virtual TreeView than can be obtained from http://www.delphi-gems.com/VirtualTreeview Delphi Chromium Embedded 3 tha... |
Thread Application Implementation in TThread Delphi provides class for thread application as TThread.Following is the simple example for thread application.type TForm1 = class(TForm) Memo1: TMemo; GroupBox1: TGroupBox; seTimeToWork: TSpinEdit; ... |
Auto Logon Programming in Delphi In case that you need to develop auto logon application based on Windows operating system. You need to access windows registry. Refer below Delphi based example. (autologon.dpr) If you want to compile above sample code, just copy & paste as autologon.dpr a... |
Changing the Title of a Print Dialog in Delphi The TPrintDialog component displays a standard Windows dialog box for sending jobs to a printer. Unfortunately, the TPrintDialog does not expose the Title property. By handing the OnShow event of a print dialog you can specify the text for the dialog’s tit... |
I want to select directory(folder) not file. How can I do that ? Delphi provides function for directory(folder) selection as following.uses FileCtrl;var dir : string;begin if SelectDirectory(dir, [sdAllowCreate, sdPerformCreate, sdPrompt], 0) then begin m_directory.Text := dir;... |
The Delphi function to get My Videos folder In order to get My Videos folder, you need to call SHGetSpecialFolderPath(). But I recommend you to use below wrapper for easy control.function GetSpecialFolderPath(Folder: Integer; CanCreate: Boolean): string;// Gets path of special system folders//// Cal... |
How to resize PNG file in Delphi ? In case that you need to change PNG file size (width, height), you can use below function. procedure copy_to_resized_png( tar, src:string; w, h: Integer); var bmp: TBitmap; png, output: TPngImage; begin &nb... |
Delphi API to get the current working directory You can get the current working directory information by GetCurrentDir function.Following is the usage example:var m_curdir:string...m_curdir := GetCurrentDir; |
Delphi API to get windows temporary directory When you need to access windows temp directory, you can get from environment variables.Following is the example to get temporary directory.var m_tempdir: string... m_tempdir := GetEnvironmentVariable('TEMP'); |
How to print external document ? Without complex programming, you can print document by ShellExecute function.use ShellAPI;...ShellExecute(Handle, 'print', PChar('c: est est.doc'), nil, nil, SW_SHOW); |
How to launch application ? You can launch application on windows by ShellExecute function. Following is the simple example to launch application.use ShellAPI;...ShellExecute(Handle, 'open', PChar('c: estapp.exe'), nil, nil, SW_SHOW);In case of running DOS command application such as... |
Is there directory selection VCL component in Delphi ? There are FileOpenDialog and FileSaveDialog components on Delphi VCL.Sometimes you may need directory selection dialog, but no components are found on VCL.Do you know Delphi provides the solution as SelectDirectory().Here are two examples for directory sel... |
How to read/wrtie INI file in Delphi ? Delphi provides useful function to access INI file. With TIniFile class, you can read and write easily.Below is the simple example writing INI files.uses inifiles;...procedure Tform1.Button1Click(Sender:TObject);var myIniFile:TIniFile;begin myI... |
Delphi Pointer Types Sometimes, you may confuse the name of the pointer type in delphi, because of the difference with C/C++. It's really make us confusion. Actually usage rule is also different, so I always forget how to use delphi pointer easily.Anyway below table is useful ... |
Save TBitmap image to Jpeg format image in Delphi Delphi supports Jpeg unit as well as Bitmap unit for image processing. Following example convert and save bitmap into jpeg format. The source format must be TBitmap instance.unit jpeg;procedure BitmapToJpeg(FileName: string; Img:TGraphic);var m_jpeg:... |
How to get parameter string ? Just like main(argv,argc) in C, Delphi also has the similar variables to get parameter string coming from command line.Following is the simple example to display parameter list by showmessage function.procedure TMainFrm.Button3Click(Sender: TObject);var i:... |
How to send email by TIdSMTP VCL ? TIdSMTP component is very useful VCL in Delphi 2009. Here's the simple example to send email.uses IdSMTP, IdMessage;;procedure KMAIL( sTo, title, body:string);var IdMsg : TIdMessage;begin IdMsg := TIdMessage.Create(nil); try ... |
Base64 Encoding/Decoding function for Delphi Base64Encoding function is frequently used in MIME Type based programming. Here's the good resource for supporting base64encode and base64decode.uses IdCoder, IdCoder3to4, IdCoderMIME, jpeg;function base64Decode(const Text : ansiString): ansiString;var&nbs... |
How to encode subject content when sending mail with TIdMessage ? Today, I tried to develop mail application with TIdMessage, but I have problem in character set encoding. And I found the answer at http://www.yac.com.pl/mt.texts.tidmessage.charset.en.htmlWith this wrapper class, TMyMessage = class(TIdMessage) ... |
When subject is crashing in TIdSMTP VCL In case of using Delphi 2009 with Indy 10, when I try to send an email with TIdSMTP, on the received email this text arrived as questions marks '?????'.This is caused by TIdSMTP VCL bug.You can fix it by upgrading Indy10 at ftp://indy.fulgan.com/ZIP. Pleas... |
Delphi string conversion functions - AnsiToUTF-8, UTF8Encode, ... Delphi already provide string conversion functions variously. You just call conversion function.function UnicodeToUtf8(Dest: PChar; Source: PWideChar; MaxBytes: Integer): Integer; overload; deprecated;function Utf8ToUnicode(Dest: PWideChar; Source: PChar; ... |
How to get file created time, modified time, and last accessed time ? In order to get the file attributes, you can get it by file search API.Here's an example of how to show the creation, last access and last modification dates and times of a file: |