Delphi Gebruikersgroep

 

Home    Up

openen file vanuit explorer

Weet iemand hoe je vanuit een delphi programma de registry zo kan instellen dat als er op een file in de explorer dubbelgeklikt wordt het delphi programma geactiveerd wordt. Voorts zou dit alleen bij files met een specifieke extensie moeten gebeuren en de filenaam moet door het delphi programma gebruikt kunnen worden. 

mail me een mogelijke antwoord ook a.u.b. naar mvanakkeren@vizzavi.nl

--

Tipje: kijk maar eens in het registry bij .txt! Hierbij wordt nl. notepad gebruikt. Voeg je eigen extensie toe (bijv .abc) en het bestand wordt als parameter meegegeven aan je Delphi-app!

--

Gevonden op het web (www.scalabium.com) : 

In the next example will be registered the file extention (.newext) - files of this type will open using MyApp.Exe application. Also will be registered the one default action and two additional items in context menu, assigned 
with this file extention. 

Example: 

uses 
Registry; 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
with TRegIniFile.Create('') do 
try 
RootKey := HKEY_CLASSES_ROOT; 
WriteString('.newext', '', 'NewExt'); 
WriteString('NewExt', '', 'Your description of NewExt files'); 
WriteString('NewExt\DefaultIcon', '', 'C:\MyApp.Exe,0'); 
WriteString('NewExt\Shell', '', 'This_Is_Our_Default_Action'); 
WriteString('NewExt\Shell\First_Action', '','This is our first action'); 
WriteString('NewExt\Shell\First_Action\command', '', 'C:\MyApp.Exe /LotsOfParamaters %1'); 
WriteString('NewExt\Shell\This_Is_Our_Default_Action', '', 'This is our default action'); 
WriteString('NewExt\Shell\This_Is_Our_Default_Action\command', '', 'C:\MyApp.Exe %1'); 
WriteString('NewExt\Shell\Second_Action', '', 'This is our second action'); 
WriteString('NewExt\Shell\Second_Action\command', '', 'C:\MyApp.Exe /TonsOfParameters %1'); 
finally 
Free; 
end; 
end; 

Hans