body {margin:0; padding:0; background:#fff; color:#000}td,body,.form {font-family:Tahoma; letter-spacing:1.1lm;font-size: 9pt}A {color:#336699; text-decoration: none;}HI,Acabei de preparar um exemplo com uma rotina que achei para visualizar um codigo HTML no componente WebBrowser sem precisar criar um arquivo.Antes quando precisa exibir algo em HTML no programa, eu criava um arquivo .html com o codigo e caregava no componente. Mas recentemente precisei exibir um codigo HTML armazenado no banco de dados. Poderia ter feito no esquema que ja sabia, mas decidi fazer algo mais decente, hehehe. Pegar o codigo e carregar diretamente no componente TWebBrowser.Download do exemplo AQUI.Ate Mais. Veja artigo completo aqui Parceiros: |BlogTips| Musas| Hacker| News| EnglishTips| TipsDelphi| FutOnline| body {margin:0; padding:0; background:#fff; color:#000}td,body,.form {font-family:Tahoma; letter-spacing:1.1lm;font-size: 9pt}A {color:#336699; text-decoration: none;}A few weeks ago I started down the path of discovering how to GeoCode addresses for Delphi. This is related to a project we had where we wanted to show a map of a given point and then show facilities located near it on a map. I had originally started working with maps.live.com (which is a MS site). They have a decent little interface for JS that seemed to work for what I wanted AND I didn't have to store the annoying little GeoCoding addresses anywhere. This works great if all you want is a single address. For instance, the code below works for single addresses:<html> <head> <title>Address Lookup </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script> <script type="text/javascript"> var map = null; var findPlaceResults = null; function GetMap() { map = new VEMap('myMap:newmap'); map.LoadMap(); map.Find(null,'100 Enterprise Way, Scotts Valley, CA 95066', null, null, null, null, true, true, null, true, GetCoordinates); } function GetCoordinates(layer, resultsArray, places, hasMore, veErrorMessage) { findPlaceResults = places[0].LatLong; var myShape = new VEShape(VEShapeType.Pushpin, findPlaceResults); myShape.SetTitle('CodeGear'); myShape.SetDescription('100 Enterprise Way<br>Scotts Valley, CA 95066<br>'+findPlaceResults.toString()); map.AddShape(myShape); } </script> </head> <body onload="GetMap();"> <div id='myMap:newmap' style="position:relative; width:800px; height:600px;"></div> </body></html>The problem showed up when I went to add the facilities to the map. Thinking it would all work the same way, I added the same Map.Find code for each facility in the state of interest and voila. Except the voila was, "How come I only get one pushpin?" not "See how great this works!" It turns out that part of the answer is the MS VEMap object works asynchronously. I could live with that if the map moved around a little as it added pushpins... well, at the very least, I could just hide the map until it was done. Unfortunately, MS also made the calls non-reentrant. This is actually what they document the problem as. To me, the code IS non-reentrant in that it never calls itself. Apparently, our definitions of re-entrant differ significantly. To MS, non-reentrant means that you have to wait for the asynchronous call to complete before you can call it again. Of course, Javascript has little support for "waiting". I was able to create a work around using a do {} while (!completed); but it causes the browser to complain mightly, ties up a lot of CPU and is just generally ugly.Seeing that this wasn't going to work very well, I went back to the