Autor Beitrag
qball
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 47



BeitragVerfasst: Di 23.03.04 15:04 
Hallo,

ich will ganz einfach einen bestimmten link, bspw. www.delphi-forum.de über einen button im standardbrowser öffnen. ich habe die hilfe bemüht, aber irgendwie steig ich da nicht ganz dahinter.
habe es bisher so probiert: actionlist->standardaktion "TBrowseURL"
da rein:
Zitat:
meinLink.URL:='http://www.delphi-forum.de';

in die buttonClick-procedure dann noch:
Zitat:
browseURL1.executetarget(meinLink);


und jetzt öffnets mir den dateiordner, in dem das delphi-projekt gespeichert wird, und nicht den internet explorer. ?????
HDStebel
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Di 23.03.04 16:29 
Versuche es doch mal hiermit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
var
  cFileName : string;
  iHandle : integer;
  pUrl : Array[0..255] of char;
begin

// URL
cFileName := 'www.page.html';

// URL in Pointer umwandeln
StrPCopy(pUrl, cFileName);

// Shell-API aufrufen
iHandle := ShellExecute(handle, 'open', pUrl, nil, nil, SW_SHOW);
// ggf. Fehlermeldung ausgeben
if iHandle <= 32 then begin
   // Fehler;
end;

end;

Viel Spaß
Dietmar

Moderiert von user profile iconPeter Lustig: Delphi-Tags hinzugefügt
G-man
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Di 23.03.04 17:08 
Wenn du die Seite im Standardbrowser aufrufen willst empfehle ich den ShellExecute()-Befehl. Dann brauchst du nicht die TWebBrowser Komponente.

_________________
...To err is human, but to really foul things up requires a computer.
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Di 23.03.04 18:48 
so kannst du dir das umwandel in einen pointer sparen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var 
   cFileName : string; 
begin 
  // URL 
  cFileName := 'www.page.html'; 

  // Shell-API aufrufen 
  iHandle := ShellExecute(handle, 'open', PChar(cFileName), nil, nil, SW_SHOW); 
end;

wichtig ist außerdem die unit shellapi einzubinden, sonst funktionierts nicht 8)
die fehlerbehandlung hab ichmir mal gespart, wird wohl beim öffnen eines links nicht so wichtig sein...

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
qball Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 47



BeitragVerfasst: Mi 24.03.04 13:28 
danke, es funktioniert!