unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ShellApi, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
OpenDialog1: TOpenDialog;
Edit1: TEdit;
Edit2: TEdit;
GroupBox1: TGroupBox;
ComboBox1: TComboBox;
Edit3: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TrimAtDoubleAt(s:
String):
String;
var iPos: Integer;
begin
Result := s;
iPos := pos('
@@', s);
If iPos>0
then
Result := copy(s, 1, iPos-1);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not OpenDialog1.execute
then exit;
Edit1.text:=Opendialog1.filename;
Edit2.text:=TrimAtDoubleAt( Edit1.text );
if combobox1.itemindex=0
then Edit3.text:='
notepad.exe';
if combobox1.itemindex=1
then Edit3.text:='
wordpad.exe';
shellexecute (0,
Nil, PChar(edit3.text), PChar(edit1.text),
Nil, SW_NORMAL);
end;
end.