how to add an option in the right click menu

hello, i have a program that encrypt a file u select (with opendialog1)  but i would like to add an option to the explorer menu u get when u right click a file or folder.
i found this already:

procedure TForm1.Button1Click(Sender: TObject);  
procedure InstalaMenuContextual( Extension,Comando,CaptionMenu  :string);
   var
     Registro : TRegistry;
     Nombre   : string;
   begin
     Registro := TRegistry.Create;
     try
       Registro.RootKey := HKEY_CLASSES_ROOT;
       if Registro.OpenKeyReadOnly('\.' + Extension) then
       begin
         Nombre := Registro.ReadString('');
         if Nombre <> '' then
           if Registro.OpenKey('\' + Nombre + '\shell', False) then
             Registro.Access := KEY_READ or KEY_WRITE;
         if Registro.OpenKey('APTprocess', True) then
         begin
           Registro.WriteString('', CaptionMenu);
           Registro.Access := KEY_READ or KEY_WRITE;
           if Registro.OpenKey('command', True) then
             Registro.WriteString('','"'+Comando+'" "%1"');
         end;
       end else Raise Exception.create('Lo siento, la extension no es conocida por Windows');
     finally
       Registro.Free;
     end;
   end;

begin

   InstalaMenuContextual( 'TST',
                          Application.ExeName,
                          'blabla');
end;

but this only will work for that extension, not for all files and of course it only calls my program, i also need my program to handle the files selected automatically.
i need to encrypt those files i select, so i would need my program to take those parameters.
like an antivirus software, u choose a bunch of files then click the option in the right click menu and it scans all the files u selected.
and if a folder is selected, it will encrypt all files in the folder.
just like an antivirus would do.

so ill be waiting for some code or hints.
manganzonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

heretoreadCommented:
This will register for all file types,

procedure RegisterMenu;
var
  Reg:TRegistry;
begin
  Reg:= TRegistry.Create;
  Reg.RootKey := HKEY_CLASSES_ROOT;
  Reg.OpenKey('*\shell\Program...\command', True);
  Reg.WriteString('', '"'+ParamStr(0)+'" "%1"');
  Reg.Free;
end;

procedure UnRegisterMenu;
var
  Reg:TRegistry;
begin
  Reg:= TRegistry.Create;
  Reg.RootKey := HKEY_CLASSES_ROOT;
  Reg.OpenKey('*\shell', true);
  Reg.DeleteKey('Program...');
  Reg.Free;
end;

But note, If you select multiple files then use the explorer menu, explorer will open your program for each file selected.

have a look at contmenu.dpr in the Program Files\Borland\Delphi\Demos\ActiveX\ShellExt folder. Thats a better way to make an explorer menu.
0
pilotzCommented:
i think this could help you: http://windowsxp.mvps.org/context_folders.htm
0
manganzonAuthor Commented:
sorry, i got busy with another project but anyway, the main problem is to handle the files u select before u click on the explorer button.
so if i have a function: encrypt(file);
it will just use that function to deal with all the files that were selected in explorer before my application was called.
how can get the name(s) of the file(s) selected in order to process them afterwards.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

D-MasterCommented:
you should  check the params of your app and execute function according to the params..

let assume your app name is ENCRYPT.exe the params may look like this
c\>ENCRYPT.exe -e somefile.txt

paramstr[0] is your app name {ENCRYPT.exe}
paramstr[1] is the parameter for encryption {-e}
paramstr[2] is the filename {somefile.txt}

just from mind...try it
0
manganzonAuthor Commented:
yea i already knew i had to use paramstr(1) for the file to be encrypted, but what if there are many files selected?
0
D-MasterCommented:
windows will treat each selected file as it is the only one selected.... and run you program as many times as the number of the selected files...so make you program to prevent more than one instance....then you'll see all the selected files opened in one instance....

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
manganzonAuthor Commented:
good enough.
:D
0
D-MasterCommented:
;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.