Search results for 'Delphi'. 123 post(s) found.

  1. 2009/09/09 Is there directory selection VCL component in Delphi ?
  2. 2009/09/09 How to launch application ?
  3. 2009/09/09 How to print external document ?
  4. 2009/09/03 Delphi API to get windows temporary directory
  5. 2009/09/03 Delphi API to get the current working directory
  6. 2009/09/03 How to resize PNG file in Delphi ?
  7. 2009/08/22 Get the length of arrays and a string
  8. 2009/08/22 Delphi Pointer Types
  9. 2009/08/21 How to read/wrtie INI file in Delphi ?
  10. 2009/08/19 How to get file created time, modified time, and last accessed time ?
2009/09/09 08:03

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

Following shows directory structure under d:\delphi
procedure TForm1.Button1Click(Sender: TObject);
var
  DirSelected: string;
begin
  if SelectDirectory('Select a folder:', 'D:\Delphi', DirSelected) then
    ShowMessage('You selected ' + DirSelected)
  else
    ShowMessage('You did not select a folder');
end;


Following shows driver names and files as well as directory structure.
procedure TForm1.Button2Click(Sender: TObject);
var
  Dir: string;
begin
  Dir := 'D:\Delphi';
  if SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], 0) then
    ShowMessage('You selected ' + Dir)
  else
    ShowMessage('You did not select a folder');
end;

Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.

2009/09/09 07:56

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:\test\app.exe'), nil, nil, SW_SHOW);


In case of running DOS command application such as batch file and you want not to display user, put SW_HIDE in the function option as follow

ShellExecute(Handle, 'open', PChar('c:\test\kurapa_backup.bat'), nil, nil, SW_HIDE);

Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.

2009/09/09 07:53

How to print external document ?


Without complex programming, you can Print document by ShellExecute function.

use ShellAPI;

.
.
.

ShellExecute(Handle, 'Print', PChar('c:\test\test.doc'), nil, nil, SW_SHOW);
Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.

2009/09/03 16:07

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');


Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.

2009/09/03 16:03

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;

Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.