Entwickler-Ecke

Sonstiges (Delphi) - Link


Fabian - Di 23.07.02 20:18
Titel: Link
Hallo,
Gibt es eine Möglichkeit einen Link auf eine Internetseite oder E-mail Addresse in mein Formular einzubinden ?


b.brecht - Di 23.07.02 20:23

Jopp klar:

Code by "czrx"

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:
uses 
  ShellAPI, Registry; 

procedure OpenURL(Url: string); 
var 
  ts: string; 
begin 
  with TRegistry.Create do 
    try 
      rootkey := HKEY_CLASSES_ROOT; 
      OpenKey('\htmlfile\shell\open\command', False); 
      try 
        ts := ReadString(''); 
      except 
        ts := ''; 
      end; 
      CloseKey; 
    finally 
      Free; 
    end; 
  if ts = '' then Exit; 
  // remove quotes and commandline parameters 
  ts := Copy(ts, Pos('"', ts) + 1, Length(ts)); 
  ts := Copy(ts, 1, Pos('"', ts) - 1); 
  ShellExecute(0, 'open', PChar(ts), PChar(url), nil, SW_SHOW); 
end; 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  OpenURL('http://www.SwissDelphiCenter.ch'); 
end;


Klabautermann - Di 23.07.02 21:01

Oder du verwendest einfach ShellExecute:


Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
ShellExecute(Application.Handle,
               'open',
               PChar('http://www.oitmann.de/meineprogs'),
               PChar(''),
               pChar(''),
               SW_SHOW);
ShellExecute(Application.Handle,
               'open',
               PChar('mailto:ich@da.de'),
               PChar(''),
               pChar(''),
               SW_SHOW);


Gruß
Klabautermann


Chatfix - Sa 27.07.02 01:33

bei klabautermanns beispiel aber auch ShellAPI in die uses-klausel aufnehmen