I try to do this :
TThread.CreateAnonymousThread(
procedure
begin
WebGMaps.Launch;
end).Start;
But I get the following error
Le projet TestGMap.exe a déclenché la classe d'exception EAccessViolation avec le message 'Violation d'accès à l'adresse 569143B5 dans le module 'mshtml.dll'. Lecture de l'adresse 00000030'.
Do you know how to thread this component ?
Please note that TWebGMaps is based on a VCL TWebBrowser control and this control is a non thread-safe VCL UI control.
It's not the reason of ths bug.
IPersistStreamInit is in an Activex which can't be threaded ;(
I've changed function TWebGMaps.Launch: Boolean;
I've replace (FWebBrowser.Document as IPersistStreamInit).Load(TStreamAdapter.Create(aStream));
with the following lines
lst:= TStringList.Create;
lst.Text := HtmlFile;
lst.SaveToFile('o:\map.html');
FWebBrowser.Navigate('o:\map.html');
lst.free;
So Now I can use a TThread to launch the map.
I don't like this version because I must write on the hard drive, but I don't see how to do otherwise.
Maybe you'll have a better idea