Scalabium Software

SMExport advertising

Knowledge for your independence'.
Home Delphi and C++Builder tips


#85: How can I save/load the glyphs to/from external file?

In some small programms sometimes very useful to store a glyphs in some external file and in run-time to load these glyphs in own TImageList. Also if the user can change the images, then in application closing you can save the TImageList contents into this external file.

For example, now I develop the small aplication for password keeper but I don't want to have the any database engine (BDE, ADO etc). I use the own file format for password storing. Each password record have the category field. For example, the Provider login, Bank secure code, Credit Card PIN, Serial Number of application etc

Of course, very useful to assign the some glyph to each category and show this glyph in password list instead full category name.

I use the next code:

procedure SaveGlyphs(FileName: string; lstImages: TImageList);
begin
  with TFileStream.Create(FileName, fmCreate or fmShareExclusive) do
    try
      WriteComponent(lstImages);
    finally
      Free;
    end;
end;

The similar code you can use for glyphs loading:

procedure ReadGlyphs(FileName: string; lstImages: TImageList);
begin
  with TFileStream.Create(FileName, fmOpenRead) do
    try
      ReadComponent(lstImages);
    finally
      Free;
    end;
end;


Published: June 14, 2000

See also
 
SMMsg suite
Excel Reader (dll)
dBase Viewer
ExcelFile Viewer
Paradox Password Recovery
Clarion Viewer
Paradox Viewer
Word Web-stream
Viewer for MS Outlook Messages
ABA Picture Convert
 
 
Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2015, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport advertising