HOME Delphi SaveToFile Print File I/O Status Check ShellExecute TJpegImage SMTP CreateFile SW_SHOW TBitmap SW_HIDE SendMail GetDriveType TPrintDialog TColor GetVolumeInformation Is Audio CD Print Dialog DelTree Rotating Text Delphi Folder Navigation Dialog Transparent Text Out TOSVERSIONINFO CreateFontIndirect ShowWindow BrowseInfo Caption Bar GetWindowsVersion available memory size Hide Caption Bar Hide Taskbar available memory Jpeg Open URL OPEN_EXISTING OS Version Information Paint Form PC 켜져 있는 시간 알아내는 방법 PHP Regular Expression PItemIDList Argc Print Text Files Animated Icon DateTimeToSystemTime Delphi File System Control Desktop Wallpaper DISP_CHANGE_FAILED DISP_CHANGE_NOTUPDATED DISP_CHANGE_SUCCESSFUL DrawMarquee EnumDisplaySettings File Delete with UNDO GetVersionEx confirm 켜져있는시간 Command Line String ColorToHtml free memory space GENERIC_READ GENERIC_WRITE

TJPEGIMAGE.ZIP

Show *any* graphics as Glyph on a SpeedButton   (created at Sep 10, 2007)   123  

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:

Save TBitmap image to Jpeg format image in Delphi   (created at Jun 25, 2009)   85  

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:...

Rotate Bitmap (any angle, any center of rotation)   (created at Sep 10, 2007)   61  

Here's how to rotate a TBitmap at any angle:Const PixelMax = 32768;Type   pPixelArray = ^TPixelArray;   TPixelArray = Array[0..PixelMax-1] Of TRGBTriple;Procedure RotateBitmap_ads(   SourceBitmap : TBitmap;   out Des...

Convert a BMP to a JPG   (created at Sep 10, 2007)   40  

You can easily convert a BMP image to a JPG (JPEG) image:{Usage:BMPtoJPG('mybitmap.bmp','myjpeg.jpg')}function BMPtoJPG   (var BMPpic, JPGpic: string):boolean;var Bitmap: TBitmap;    JpegImg: TJpegImage;begin  Result:=False;  ...

How to convert an ICO to a BMP   (created at Sep 10, 2007)   40  

If you have an icon file (ICO) and want to convert it to a bitmap image, use the following code: Procedure IcoToBmp; var   Icon : TIcon;   Bitmap : TBitmap; begin   Icon := TIcon.Create;   Bitmap := TBitmap.Create;   Icon.LoadFromF...

Grayscaling a bitmap ?   (created at Sep 10, 2007)   81  

This example uses an averaging mechanism to obtain grayscale intensity on a pixel-by-pixel basis. Specifically, it averages the Red, Green and Blue component values of a color and assigns that value back to each RGB component. Usage: GrayScale(Image1.Pictu...

Paint a Form with a tiled bitmap image   (created at Sep 10, 2007)   66  

Here's how to draw tiled bitmap image on a Form:type   TForm1 = class(TForm)     procedure FormCreate(Sender: TObject) ;     procedure FormPaint(Sender: TObject) ;     procedure FormClose(Sender: TObje...

Delete files with the ability to UNDO   (created at Sep 10, 2007)   43  

Here's a Delphi procedure that can delete a file with the ability to undo by sending the file to the "Recycle Bin."Function FileDeleteRB will return True if the operation was successful.uses ShellAPI;function FileDeleteRB( AFileName:string): boolean;var St...

Does my CD-ROM drive contain an audio CD?   (created at Sep 10, 2007)   37  

We can use the Windows API function GetDriveType() to test if the drive is a CD-ROM drive then use the Windows API function GetVolumeInformation() to test if the VolumeName is 'Audio CD'.function IsAudioCD(Drive : char) : bool;var   DrivePath : s...

Convert a mapped drive to a full UNC path   (created at Sep 10, 2007)   87  

Universal/Uniform Naming Convention. A UNC path describes the location of a volume, directory, or file.The format for a UNC path is \servervolumedirectoryfile and is not case-sensitive. For example:    \Shared1_svrShared1WGroupsNetworkOrders.xlsR...

Checking If File Is In Use   (created at Sep 10, 2007)   55  

IsFileInUse will return true if the file is locked for exclusive access. It would fail if the file doesn't exist at all. function IsFileInUse(fName : string) : boolean;var    HFileRes : HFILE;begin    Result := false;    if no...

Browse for Computers, Folders, Files and Printers   (created at Sep 10, 2007)   49  

By using the SHBrowseForFolder Windows API function and Delphi we can invoke a Windows system dialog used to browse for files and folders on users hard drive as well as network computers and printers. First, let's look at what SHBrowseForFolder needs. Here...

How to draw Transparent Text on bitmap   (created at Sep 01, 2007)   61  

You can set transparent mode by calling SetBkMode function.procedure TForm1.Button1Click(Sender: TObject);begin  with Image1.Picture.Bitmap.Canvas do  begin    Font.Color  := clBlue;    Brush.Style := bsclear;   ...

How Do I Remove The Application Icon From The Taskbar?   (created at Aug 25, 2007)   46  

To remove the icon from the taskbar, you need to call a Windows API call:BOOL ShowWindow(HWND hwnd,int nCmdShow);Delphi makes it very easy to use this command. All you need to do is supply the Application.handle and SW_HIDE to remove the icon from the task...

How To Show The Print Dialog And Print Text Files   (created at Aug 25, 2007)   69  

This code show an example of how to print a text of a RichEdit component.unit Unit1; interface uses   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,   StdCtrls, ComCtrls; type   TForm1 = class(TForm)     ...

How To Make An Animated Application Icon   (created at Aug 25, 2007)   80  

Show how to create an animated icon in your programvar  icon1:Boolean; ... procedure TForm1.Timer1Timer(Sender: TObject); begin   if icon1=false then   begin     Application.icon:=Image1.Picture.Icon;      icon1:=tru...

How To Pass The Focus To The Next/prior Control   (created at Aug 25, 2007)   70  

Shows how to activate the next or prior control in a formnext control: SendMessage(Form1.Handle, WM_NEXTDLGCTL, 0, 0); prior control: SendMessage(Handle, WM_NEXTDLGCTL, 1, 0);

How To Make Rounded Windows   (created at Aug 25, 2007)   50  

Create a different form in your application...procedure TForm1.FormCreate(Sender:TObject);  var    region: HRgn;  begin    region:=CreateEllipticRgn(1,1,200,200);    SetWindowRgn(handle, region, true);  end;

How To Get Windows Uptime   (created at Aug 25, 2007)   64  

Find how long Windows has been working...function UpTime: string; const ticksperday : integer = 1000 * 60 * 60 * 24; ticksperhour : integer = 1000 * 60 * 60; ticksperminute : integer = 1000 * 60; tickspersecond : integer = 1000; var  t : longword; &nb...

How To Find Out Total And Available Memory   (created at Aug 25, 2007)   44  

Get the total and available memory in your system. (Total free memory space in your system)procedure TForm1.Button1Click(Sender: TObject); var   memory:TMemoryStatus; begin   memory.dwLength:=sizeof(memory);   GlobalMemoryStatus(memory); &nb...

How To Change The System Time   (created at Aug 25, 2007)   56  

This code shows how to set the system time to another value.procedure TForm1.Button1Click(Sender: TObject); var    systemtime : TSystemTime;    NewTime:string; begin    NewTime:='13:58:00';    DateTimeToSystemTime( D...

How To Get The Windows OS Version   (created at Aug 25, 2007)   59  

 Identify the Windows version of your systemfunction GetWindowsVersion : string;  var    OsVinfo   : TOSVERSIONINFO;    HelpStr   : array[0..50] of char;  begin    ZeroMemory(@OsVinfo,sizeOf(OsVinfo));...

How To Change The Desktop Wallpaper   (created at Aug 25, 2007)   48  

Change the wallpaper of your system by codeuses    Registry, WinProcs;  procedure SetWallpaper(               sWallpaperBMPPath : String;               bTile : boolean );&...

How To Get The Windows Language   (created at Aug 25, 2007)   57  

Obtains the language that Windows is using.function Language:string;  var    sLangID:LangID;    sLanguage: array [0..100] of char;  begin    sLangID:=GetSystemDefaultLangID;    VerLanguageName(sLangID,sLang...

How To Make A Gradient Filled Form   (created at Aug 25, 2007)   48  

Show how to paint a form in a different way...procedure TForm1.FormPaint(Sender: TObject); var   Row, Ht: Word;   IX: Integer; begin   iX :=200 ;   Ht:=(ClientHeight + 512) div 256;   for Row := 0 to 512 do   begin   &nbs...

How can I hide the caption bar on a form?   (created at Aug 25, 2007)   41  

To hide the caption bar you need to override on of the default form methods CreateParams (this also exists for other objects).The CreateParams method initializes a window-creation parameter record passed in the Params parameter (ref:Delphi Help).Go to the ...

How To Send An E-mail By Code   (created at Aug 25, 2007)   40  

Use this function to send an e-mail through your program. You must have the component TNMSMTP from FastNet tools. This component is included in Delphi 4-5 Professional and Enterpriseprocedure TForm1.Button1Click(Sender: TObject); begin   NMSMTP1.Host ...

How To Open Url In Default Webbrowser   (created at Aug 25, 2007)   50  

Use this function to open your browser with a given URL.uses    shellapi;  ....  procedure TForm1.Label1Click(Sender:TObject);  begin    shellexecute(handle,'open','http://www.swissdelphicenter.ch', nil,nil,sw_show); ...

How To Check If A Soundcard Is Installed   (created at Aug 25, 2007)   54  

Use this code to verify if a soundcard is installed in your systemuses mmsystem;  ...  function Soundkarte:Boolean;  begin    Result := WaveOutGetNumDevs >0;  end;

How To Change Screen Resolution   (created at Aug 25, 2007)   95  

Change the resolution of your screen.Actually I've ever used this function for TV-based software development, because of TV-resolution.{ The function NewRes can have the following result: DISP_CHANGE_SUCCESSFUL The settings change was successful. DISP_CHAN...