Autor Beitrag
MDX
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 595
Erhaltene Danke: 4

Windows 8.1, Linux Debian 8, Android Lollipop
Delphi, PHP, Java (Android)
BeitragVerfasst: Mi 17.09.08 10:21 
Hallo, ich habe in der Windows-Registery das Protokoll "PR://" registriert, wenn man nun im Browser "PR://ABC" eingibt, öffnet sich mein Programm, wie kann ich nun das "ABC" auslesen?

THX
MDX
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 17.09.08 12:05 
Soweit ich weiß, wir das als ganz normale Parameter übergeben.
Du kannst also mit paramstr(x) drauf zugreifen.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
MDX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 595
Erhaltene Danke: 4

Windows 8.1, Linux Debian 8, Android Lollipop
Delphi, PHP, Java (Android)
BeitragVerfasst: Fr 31.10.08 23:06 
Und was muss bei x hin?

Registriert ist das Protokoll mit: "ABCEF GHIJ KL" bei 1 kommt: "ABCDEF" bei 2: "GHIJ" und bei 3: "KL" bei 4: garnix.

Wie kann ich nun das auslesen?
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Fr 31.10.08 23:17 
X kann in einer SChleife die Werte 1 bis ParamCount annehmen, damit bekommst du alles.

Gruß
alias5000

_________________
Programmers never die, they just GOSUB without RETURN
MDX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 595
Erhaltene Danke: 4

Windows 8.1, Linux Debian 8, Android Lollipop
Delphi, PHP, Java (Android)
BeitragVerfasst: Sa 01.11.08 04:38 
Sorry für die frage:
Was genau muss ich jetzt machen :wink: ?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 01.11.08 10:14 
ausblenden Delphi-Quelltext
1:
2:
3:
Params := '';
for X := 1 to ParamCount do
  Params := Params + ParamStr(X) + ' ';

War das jetzt schwer?

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
MDX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 595
Erhaltene Danke: 4

Windows 8.1, Linux Debian 8, Android Lollipop
Delphi, PHP, Java (Android)
BeitragVerfasst: Sa 01.11.08 14:21 
Ja, weil ich mich noch nicht wirklich mit schleifen beschäftigt hab (Delphi)

Es geht aber immer noch nicht:

Also der Link auf der Website ist: PR://123
Wenn das Programm geöffnet wird, kommt nur "PROGRAMNAME VERSION" so wie ich den Typ registriert hab:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm5.FormCreate(Sender: TObject);
var regist: TRegistry;
begin
with TRegistry.Create do try
 RootKey:=HKEY_CLASSES_ROOT;
 if not OpenKey('\pr',True) then exit; // Fehler beim Zugriff
 WriteString('URL Protocol','');
 if not OpenKey('\pr\shell\open\command',True) then exit; // Fehler
 WriteString('','"'+Application.ExeName+'" PROGRAMMNAME VERSION ');
finally
 CloseKey;
 Free;
end;
end;


Kann auch sein das hier was fehlt
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: Sa 01.11.08 15:38 
%1 ist der Parameter, der in die Registry noch in die auszuführende Kommandozeile muss. Dieser wird dann durch die Parameter ersetzt.

Das würde ich statt PROGRAMMNAME VERSION erwarten, wenn du das brauchst eben dahinter.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Sa 01.11.08 17:24 
Du kannst für die Parameter keine Namen vergeben. Ich denke, genau das wolltest du mit "PROGRAMMNAME VERSION" erreichen. Windows übergibt diese Parameter einfach so, wie sie drin stehen. Wenn sie ersetzt werden sollen, musst du wie schon erwähnt das Prozentzeichen mit einer Zahl - im Normallfall 1 - einsetzen.

Um trotzdem an den Programmname und die Version zu kommen, musst du die URL so aufbauen:

ausblenden Quelltext
1:
PR://programmname=abc&version=123					

Den Text nach dem PR:// kannst du ganz normal mit ParamStr(1) auslesen - du braucht nicht mal eine Schleife.