Ребята спасибо Вам огромное за помощь! Все работает. Вот собственно сам код сего:
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
OpenDialog1: TOpenDialog;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
openDialog : TOpenDialog;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
openDialog := TOpenDialog.Create(self);
openDialog.InitialDir := GetCurrentDir;
openDialog.Options := [ofFileMustExist];
openDialog.Filter:='Файл ключ KIS 2011|*.key';
if openDialog.Execute
then ShowMessage('File : '+openDialog.FileName)
else ShowMessage('Файл ключ KIS 2011 не выбран');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
WinExec (PChar('C:\Program Files\Kaspersky Lab\Kaspersky Internet Security 2011\avp.exe' + ' ' + 'addkey' + ' ' + '"' + OpenDialog.FileName +'"'), SW_HIDE);
end;
end.
Код конечно можно пилить в сторону улучшения в виде удачного или не удачного завершения операции или что еще душе угодно. Свое я добился, за что кланяюсь за помощь перед всеми кто помог воплотить в жизнь идею.