Archive for the 'Files' Category

27 May

Get a unique name for temporary file

Using GetTempFileName, we can create a unique name for temporary file. It’s useful when your application is using temporary files and you want to save them into default TEMP folder and use a “random” filename.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
25 May

How to detect application associated with file

To get full path to application associated with any file type, we need standard ShellAPI unit and the rest will do the FindExecutable function.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
15 May

Searching for string within a file

To search for a specific substring within any type of file, we can use this rather complex function.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
11 Apr

Delete file to Recycle Bin

This short tip will show you how to delete file to Recycle Bin. We need ShellAPI unit and the rest is very simple.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
08 Apr

Volume serial number

With this simple function, you will be able to get volume serial number and label. It could be either hard disk partition or CD/DVD disk.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
27 Mar

Application version

Using this simple function, you will be able to read version information from any application executable. It’s very useful for example to show your own application version on title bar or “About” dialog.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
01 Jan

CRC32 (Cyclic Redundency Check)

One of the most effective method to check if the file is ok is to calculate CRC32 checksum and compare it with previously saved value. Using CRC check, you can also compare two files, verify downloaded files etc…

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
31 Dec

Shortened version of a filename

The length of whole path and file name could be too long to show it in title bar of application or some label. Solution? Show shortened version of a filename using dots instead of folders.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
26 Nov

How to locate important system directories

Using ShlObj unit and SHGetSpecialFolderLocation Windows API function, we can retrieve the location of a special folders, such as My computer, Desktop, Program Files etc… There are over 20 special folder locations.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
16 Oct

Directory structure with associated icons and file info in ListView

Using ShellAPI unit and few lines of code, we can load directory structure into ListView and show associated icons and information for each file.

  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Technorati
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace