반응형
procedure TfrmMain.NavigateToPost(m_WebBrowser: IWebBrowser2; const URL: String);
const
_POST_HEADER = 'Content-Type: application/x-www-form-urlencoded'+ #10#13#0;
var
Header : OleVariant;
VPostData : OleVariant;
tmp : OleVariant;
MainURL : OleVariant;
BufferArr : TArrayString;
PostData : String;
Loop : Integer;
T : IWebBrowser;
begin
try
Header := _POST_HEADER;
BufferArr := ParceStr(URL, '?');
MainURL := BufferArr[0];
if High(BufferArr) >= 1 then PostData := BufferArr[1];
MainURL := 'localhost/test.asp';
VPostData := VarArrayCreate([0, Length(PostData)], varByte);
for Loop := 0 to Length(PostData)- 1 do
begin
VPostData[Loop] := Ord(PostData[Loop+ 1]);
end;
VPostData[Length(PostData)] := 0;
if not Assigned(m_WebBrowser) then
begin
m_WebBrowser := CreateOleObject('Internetexplorer.Application') as IWebBrowser2;
m_WebBrowser.Visible := True;
end;
m_WebBrowser.Navigate2(MainURL, tmp, tmp, VPostData, Header);
SetWindowPos(m_WebBrowser.HWnd, HWND_TOP, m_WebBrowser.Left, m_WebBrowser.Top, m_WebBrowser.Width, m_WebBrowser.Height, SWP_SHOWWINDOW);
except
//
end;
end;
해당 URL과 웹브라우저 객체를 넘겨받아(없으면 생성한다) Post 방식으로 호출.
반응형
'Programming > Delphi' 카테고리의 다른 글
| 작업표시줄에 프로그램 표시하기/숨기기 (0) | 2010.06.30 |
|---|---|
| Access violation 난 곳 찾기 (0) | 2010.06.30 |
| 윈도우 종료 5가지 방법 (0) | 2010.06.30 |
| INI 파일 사용하기 (0) | 2010.06.30 |
| 레지스트리에서 프린트 이름 얻기 (0) | 2010.06.30 |