반응형
우선 USUS에 SHDocVw 추가 하시구요.
function Get_IE_URL:string;
var
ClientSite: IOleClientSite;
WebBrowserApp: IWebBrowserApp;
ServiceProvider: IServiceProvider;
WebBrowser2: IWebBrowser2;
begin
Result := '';
if (ComObject as IOleObject).GetClientSite(ClientSite) = S_OK then
begin
if (ClientSite <> nil) then
begin
ClientSite.QueryInterface(IServiceProvider, ServiceProvider);
if (ServiceProvider <> nil) then
begin
ServiceProvider.QueryService( IWebBrowserApp, IWebBrowserApp, WebBrowserApp);
if (WebBrowserApp <> nil) then
begin
WebBrowser2 := IWebBrowser2(WebBrowserApp);
Result := WebBrowser2.Get_LocationURL;
end;
end;
end;
end;
end;
function Get_IE_URL:string;
var
ClientSite: IOleClientSite;
WebBrowserApp: IWebBrowserApp;
ServiceProvider: IServiceProvider;
WebBrowser2: IWebBrowser2;
begin
Result := '';
if (ComObject as IOleObject).GetClientSite(ClientSite) = S_OK then
begin
if (ClientSite <> nil) then
begin
ClientSite.QueryInterface(IServiceProvider, ServiceProvider);
if (ServiceProvider <> nil) then
begin
ServiceProvider.QueryService( IWebBrowserApp, IWebBrowserApp, WebBrowserApp);
if (WebBrowserApp <> nil) then
begin
WebBrowser2 := IWebBrowser2(WebBrowserApp);
Result := WebBrowser2.Get_LocationURL;
end;
end;
end;
end;
end;
반응형