Autor Beitrag
LittleBen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 258
Erhaltene Danke: 4

Win 7, Mac OS
Delphi 7
BeitragVerfasst: Mi 21.09.11 18:11 
Hallo,
um den Internet Explorer aus meinem Programm heraus zu starten benutze ich folgenden Code.
ausblenden 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:
procedure OpenIE(aURL: string);
var
  IE: Variant;
  WinHanlde: HWnd;
begin
 if (VarIsEmpty(IE)) then
 begin
  IE:= CreateOleObject('InternetExplorer.Application');
  IE.Visible:= true;
  IE.Navigate(aURL);
  IE.Quit;
 end
 else
 begin
  WinHanlde:= FindWindow('IEFrame'nil);
  if (0 <> WinHanlde) then
  begin
   IE.Navigate(aURL);
   SetForegroundWindow(WinHanlde);
  end
  else
   ShowMessage('Can''t open IE !');
 end;
end;
(www.swissdelphicente.../showcode.php?id=107) Nun will ich aber, dass nach dem laden der Seite, also NavigateComplete, der IE wieder geschlossen wird. Wie kann ich überprüfen, ob die Seite ganz geladen wurde? Hoffe, ihr könnt mir helfen!

Viele Grüße,
Benny
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mi 21.09.11 18:14 
Warte mal ganz kurz:
Welchen Sinn hat das denn, extra den Internet Explorer einzubinden, um eine Webseite aufzurufen, nur um das Ganze dann sofort wieder zu schliessen?

Willst du einfach nur eine URL aufrufen, um etwa ein PHP Script im Hintergrund zu triggern? Wenn ja, dann ginge das auch einfacher!

_________________
Delphi: XE - OS: Windows 7 Professional x64
LittleBen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 258
Erhaltene Danke: 4

Win 7, Mac OS
Delphi 7
BeitragVerfasst: Mi 21.09.11 18:17 
user profile iconHorschdware hat folgendes geschrieben Zum zitierten Posting springen:
Willst du einfach nur eine URL aufrufen, um etwa ein PHP Script im Hintergrund zu triggern? Wenn ja, dann ginge das auch einfacher!
Ja, genau. Aber wenn ich das anderst mache werden Administratorreche verlangt. Das will ich verhindern.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 21.09.11 18:33 
Dann machst du was falsch. Man benötigt keine Administrator-Rechte, um auf eine Seite im Netz zuzugreifen. Das geht mit den Indy-Komponenten einfach so.

_________________
We are, we were and will not be.
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mi 21.09.11 18:35 
Wie hast du das denn bisher (ohne IE) probiert?
Schau doch mal in die Suche, da gibt es schöne Beispiele, wie so etwas von anderen gelöst wurde
-> Suche in: Delphi-Forum URL AUFRUFEN
-> Suche in: Delphi-Forum INDY HTTP

_________________
Delphi: XE - OS: Windows 7 Professional x64
LittleBen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 258
Erhaltene Danke: 4

Win 7, Mac OS
Delphi 7
BeitragVerfasst: Mi 21.09.11 18:45 
Das Problem ist, das bei allen internen URL Aufrufen Admininistratorrechte benötigt werden oder die Firewall/Anti Viren Schutz anschlägt. Das Verzägert den Start...
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 21.09.11 19:14 
Dann machst du was falsch, abgesehen evtl. von der Firewall-Warnung, die einem ein Gefühl von Sicherheit geben soll.

Ich rufe z.B. in meinem Player an einigen Stellen (teilweise auch im Hintergrund) Textdateien oder kleine PHP-Scripte im Netz auf, und bisher kam keine Rückmeldung von Virenscannern, oder Hinweise bzgl. Administrator-Rechte.

Und wenn du nicht willst, dass ggf. eine Firewall fragt, ob dein Programm ins Netz darf, dann stellt sich mir die Frage nach der Rechtmäßigkeit deines Vorhabens. :roll:

_________________
We are, we were and will not be.
LittleBen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 258
Erhaltene Danke: 4

Win 7, Mac OS
Delphi 7
BeitragVerfasst: Mi 21.09.11 19:20 
AntiVir schlägt bei mir auch kein Alarm. Habe aber BullGuard, ein etwas besserer Scanner. Naja, dann werde ich es wohl doch mit Indy machen... Aber es sollte doch eigentlich nicht so schwer sein per Ole abzufragen, ob die aufgerufene Seite fertig geladen ist.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19312
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 21.09.11 21:32 
user profile iconLittleBen hat folgendes geschrieben Zum zitierten Posting springen:
Aber es sollte doch eigentlich nicht so schwer sein per Ole abzufragen, ob die aufgerufene Seite fertig geladen ist.
Vielleicht damit:
www.swissdelphicente...showcode.php?id=2058

Aber eine saubere Lösung ist das absolut nicht...
LittleBen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 258
Erhaltene Danke: 4

Win 7, Mac OS
Delphi 7
BeitragVerfasst: Do 22.09.11 14:34 
Maaaaaan! Das ist so enfach...Um abzufragen, ob die aufgerufene Seite geladen wurde, muss nur die getan werden:
ausblenden Delphi-Quelltext
1:
2:
while IE.Busy do
 application.ProcessMessages
Gibt's da irgendwie ein Haken?
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Do 22.09.11 15:02 
Netter Versuch ;-)

aber das wird nicht funktionieren.
Du hast hier lediglich eine Schleife, die solange "nichts" tut (ausser Nachrichten des Systems zu verarbeiten), bis der IE "fertig" ist. Ob er dabei die Seite erfolgreich geladen hat oder wegen falscher URL / Server down / keine Verbindung abbricht ist dabei dann egal.

_________________
Delphi: XE - OS: Windows 7 Professional x64
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Do 22.09.11 15:08 
Indy Beispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  http: TIdHTTP;
  html: String;
begin
  http := TIdHTTP.Create(nil);
  try
    html := http.Get('http://www.google.de/q=Suchwort', s);
  finally
    http.free;
  end;
end;


Wenn dabei dein Viren-Scanner reinfunkt hast du ihn wohl falsch konfiguriert (zu aggressiv) oder es ist sinnvoll dich von ihm zu trennen...
LittleBen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 258
Erhaltene Danke: 4

Win 7, Mac OS
Delphi 7
BeitragVerfasst: Mi 05.10.11 20:20 
Heute habe ich mich nochmal mit diesem Thema beschäfftigt (da ich diese Funktion wieder brauche) und dabei musste ich festellen, dass der Internet Explorer manchmal abstürzt und Win7 die Fehlermeldung "Internet Explorer 8 Funktioniert nicht mehr" ausgibt. Woran kann das liegen, wenn die Funktion
ausblenden 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:
procedure OpenIE(aUrl: string);
var IE: Variant;
    WinHanlde: HWnd;
begin
 if (VarIsEmpty(IE)) then
 begin
  IE:= CreateOleObject('InternetExplorer.Application');  // Hier stürzt er dann ab
  IE.Navigate2(aUrl);

  while IE.Busy do                 // Funktioniert wunderbar!
   Application.ProcessMessages;
  IE.Quit;
 end
 else
 begin
  WinHanlde:= FindWindow('IEFrame'nil);
  if (0 <> WinHanlde) then
  begin
   IE.Navigate2(aUrl);
   SetForegroundWindow(WinHanlde);
  end
  else
   ShowMessage('Can''t open IE !');
 end;
end;
mehrmals im Programm aufgerufen wird.

Hoffe, dass jemand helfen kann!
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Mi 05.10.11 21:11 
Also nur mal nebenbei: ein programm, was Internet-Explorer benutzt, um an der Firewall vorbeizukommen, halte ich nicht für vertrauenerweckend.
LittleBen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 258
Erhaltene Danke: 4

Win 7, Mac OS
Delphi 7
BeitragVerfasst: Sa 08.10.11 10:52 
Hab das Ganze jetzt doch mit Indy gelöst.