Autor Beitrag
DorJo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: Mi 22.04.09 22:25 
Hy @ all,
ich wollte das Script vom Delphi Treff nutzen um eine bestimmte Dateiendung für mein Programm zu reservieren. Das klappt auch auf der lokalen Maschine sehr gut, nur bei Dateien die im Netzwerk liegen hapert es noch! Da fragt er mich jedesmal wieder (selbst wenn ich auf "diese Anwendung immer benutzen" klicke) mit welchem Programm ich die Datei öffnen will!

Hier der Code:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
function InstallExt(Extension, ExtDescription, FileDescription,
OpenWith, ParamString: string; IconIndex: Integer = 0): Boolean;    //Dateiendung reservieren
var
  Reg: TRegistry;
begin
  Result := False;
  if (Extension<>'') then
  begin
    if (Extension[1]<>'.') then
      Extension := '.' + Extension;

    Reg := TRegistry.Create;
    try
      Reg.RootKey := HKEY_CLASSES_ROOT;
      if Reg.OpenKey(Extension, True) then
      begin
       Reg.WriteString('', ExtDescription);
       if Reg.OpenKey('\' + ExtDescription, True) then
       begin
         Reg.WriteString('', FileDescription);
         if Reg.OpenKey('DefaultIcon', True) then
         begin
           Reg.WriteString('', Format('%s,%d', [OpenWith, IconIndex]));
           if Reg.OpenKey('\' + ExtDescription + '\Shell\Open\Command', True) then
           begin
             Reg.WriteString('', Format('"%s" "%s"', [OpenWith, ParamString]));
             Result:=True;
           end;
         end;
       end;
     end;
  finally
    Reg.Free;
  end;
  end;
end;


Muss ich da vielleicht die Registrierung auf dem Server vornehmen?
Weiß jemand woran es liegen könnte? Danke schonmal im vorraus!

Lg
DorJO
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 22.04.09 22:56 
Das sollte keinen Unterschied machen, denn die Dateierweiterung ist ja das Entscheidende, nicht wo die Datei liegt. :nixweiss:
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: Sa 25.04.09 01:27 
hmm... dachte ich auch! Aber dennoch funktioniert es ja nicht so wie es sollte :( Weiß vielleicht jemand einen Trick?

MfG
DorJo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 139



BeitragVerfasst: Mo 27.04.09 07:54 
*push*
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 27.04.09 08:04 
Da gibts keinen Trick, bei mir klappt das mit dem Quelltext problemlos auch im Netzwerk, sowohl unter XP als auch unter Vista. Jeweils mit Adminrechten natürlich.

Ich weiß nicht warum das bei dir nicht geht. :nixweiss: