BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting url of current IE

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Development
View previous topic :: View next topic  
Author Message
Zarkas
Guest





PostPosted: Thu Feb 05, 2004 1:02 pm    Post subject: Getting url of current IE Reply with quote



Ran into a strange problem today.

Made a small program that added a button to IE and launched my com
object when i clicked on it.
In the com object i implemented the IObjectWithSite interface and
stored the IWebBrowser2 i got from the setsite function.

When only using one browser it works great, but if there are 2 or more
browers my geturl function often returns the url of one of the other
browsers.
Any suggestions to how i get the currently active browsers url only?

function TTmywhois.SetSite(const pUnkSite: IUnknown): HResult;
var
Sp: IServiceProvider;
begin

if Assigned(pUnkSite) then begin
punkSite.QueryInterface(IID_IInputObjectSite, m_pSite);
cmdTarget := pUnkSite as IOleCommandTarget;
Sp := CmdTarget as IServiceProvider;
Sp.QueryService(IWebbrowserApp, IWebbrowser2, IE);

end;
Result := S_OK;
end;

function TTmywhois.GetSite(const riid: TIID;
out site: IUnknown): HResult;
begin
result :=S_OK;

end;


function TTmywhois.GetUrl: string;
begin;
result :=IE.LocationUrl;
end;
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Development All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.