 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Johnnie Norsworthy Guest
|
Posted: Tue May 08, 2007 8:12 am Post subject: Getting Cookies from All Running IE Instances |
|
|
I need to be able to iterate though all instances of IE and examine the
underlying OleObject.Document.Cookie to determine if a web site has
authorized so I don't try to log in again, but instead use the existing
credentials in the cookie.
I saw some code that might help, but I do not know how ot get to the
cookies:
var
x : Integer;
ShellWindows : IShellWindows;
Browser : IWebBrowser2;
IE: TInternetExplorer;
begin
Result := '';
{ IShellWindows can provide interfaces to open browser windows. }
ShellWindows := CoShellWindows.Create;
for x := 0 to Pred(ShellWindows.Get_Count) do
ShowMessage( ( ShellWindows.Item( x ) as IWebBrowser2 ).LocationURL );
Browser := ( ShellWindows.Item( 0 ) as IWebBrowser2 );
Any help would be appreciated. Thanks!
-Johnnie |
|
| Back to top |
|
 |
Johnnie Norsworthy Guest
|
Posted: Tue May 08, 2007 8:12 am Post subject: Re: Getting Cookies from All Running IE Instances |
|
|
I found a solution to this. I do some extra tests in my real application
code, but this is the technique I used (for future web searchers).
-Johnnie
function FindCookies: string;
var
ShellWindow: IShellWindows;
WB: IWebbrowser2;
spDisp: IDispatch;
iDoc: IHTMLDocument2;
i: Integer;
begin
Result := '';
ShellWindow := CoShellWindows.Create;
for i := 0 to ShellWindow.Count do
begin
spDisp := ShellWindow.Item(i);
if spDisp = nil then Continue;
spDisp.QueryInterface(iWebBrowser2, WB);
if WB <> nil then
begin
WB.Document.QueryInterface(IHTMLDocument2, iDoc);
Result := iDoc.cookie;
end;
end;
end; |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|