je suis en train de afficher une carte avec google maps, sur twebrowser sur delphi 2010, mais ça se plante et affiche "connection clossed gracefully"
je sais si qlq a une fois ce blem, pour ce qui veulent voir le petit code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,stdctrls,shellapi, TypInfo, WebServExp, WSDLBind, XMLSchema, WSDLPub,shdocvw,activex,
  OleCtrls,idhttp, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    Adresse: TEdit;
    cp: TEdit;
    ville: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    WSD: TWSDLHTMLPublish;
    wb: TWebBrowser;
    IdHTTP: TIdHTTP;
    procedure Button1Click(Sender: TObject);
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
     s:string;
 
    function Search(const Adresse : string; const CP : string; const Ville : string):string;
    procedure LoadHTML(AWebBrowser: TWebBrowser; const HTMLCode: string);
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
function tform1.Search(const Adresse : string; const CP : string;const Ville : string):string;
var URL : string;
begin
//  URL := 'http://maps.google.fr/maps?f=q&hl=fr&q=';
//  URL := URL + Adresse + ' ,+ ' + CP + '+' + Ville;
 
   //
   with TIdHTTP.Create(nil) do
  try
 
    s := Get('http://maps.google.fr/maps?f=q&hl=fr&q='+Adresse + ' ,+ ' + CP + '+' + Ville);
  finally
    Free;
  end;
  //
 // ShellExecute(GetDesktopWindow(), 'open', PChar(URL), nil, nil, SW_SHOWNORMAL);
 result:=s;
end;
 
 
 
 
 
procedure tform1.LoadHTML(AWebBrowser: TWebBrowser; const HTMLCode: string);
var
  ss: TStringStream;
  sa: TStreamAdapter;
  URL :string;
 
begin
  // Il est nécessaire de réinitialiser la page avec un appel à Navigate
  AWebBrowser.Navigate('about:blank');
 
 
 
  // Il faut attendre que le navigateur soit prêt
  while AWebBrowser.ReadyState < READYSTATE_INTERACTIVE do
   Application.ProcessMessages;
 
  if Assigned(AWebBrowser.Document) then
  begin
    // On crée un flux
    ss:= TStringStream.Create(HTMLCode);
    try
      // et un adaptateur IStream
      sa:= TStreamAdapter.Create(ss); // Ne pas libérer
 
      // On appelle la méthode de chargement du WebBrowser
      (AWebBrowser.Document as IPersistStreamInit).Load(sa);
    finally
      // On libère le flux
      ss.Free;
    end;
  end;
 
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
 
    LoadHTML(wb,Search( adresse.Text , cp.Text , Ville.Text )); //clic pour afficher la carte
 
end;
 
end.