반응형
// [1] // uses SHDocVw, ActiveX function GetScriptOfHTML(Web: TWebBrowser; HTML: TStrings) : Boolean; var PersistStream: IPersistStreamInit; Stream: IStream; FileStream: TmemoryStream; begin try if not Assigned(Web.Document) then begin Result := False; //ShowMessage('Document not loaded!'); Exit; end; PersistStream := Web.Document as IPersistStreamInit; FileStream := TmemoryStream.Create; try Stream := TStreamAdapter.Create(FileStream, soReference) as IStream; if Failed(PersistStream.Save(Stream, True)) then //ShowMessage('SaveAs HTML fail!'); Result := False; FileStream.Position := 0; HTML.Clear; HTML.LoadFromStream( FileStream ); finally FileStream.Free; end; except Result := False; end; end;
// [2] web_Main.OleObject.Document.DocumentElement.InnerHTML;
1번 방법과 2번 방법을 소개했는데, 두 개의 차이점이 있다.
줄바꿈, 들여쓰기 등의 차이점이 있지만 중요한 것은..
page.asp?a=1&b=2 <-- 요것이 HTML안에 있다면,
1번은 아주 잘표현을 하지만, 2번은 깨져서 나온다. 아마도 String 에서 &B 이런식으로 하면 단축키(?)로 먹혀 버린다.
더 자세한 것은 살펴볼까 했지만,,, 귀차니즘의 압박으로 확인도 안해보고.. (워낙 덤벙거리는 성격이라 ㅠ_ㅠ)
반응형
'Programming > Delphi' 카테고리의 다른 글
sleep 대체 함수 (0) | 2011.01.21 |
---|---|
TWebBrowser 페이지 로딩완료시까지 대기하기 (0) | 2011.01.21 |
[Local DB] NexusDB (0) | 2011.01.12 |
E2220:Never-build package '%s' requires always-build package '%s' (0) | 2011.01.11 |
현재 OS 알아내기 (0) | 2010.12.16 |