Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pass Parameter from custom IE toolbar button

0 views
Skip to first unread message

v...@ausi.com

unread,
Sep 21, 2006, 11:33:27 AM9/21/06
to
(If this is not the right newsgroup to post to, I would appreciate it
if you could refer me to the right one. Thanks)

I followed the directions to add a button to IE's toolbar found here:

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/e...

so that it would execute my .exe program.

It works beautifully! :)

Now, I would like to be able to pass to my .exe program some parameter
that would identify that particular instance of IE window (in a case
that there are more than a single IE window open).

Is this possible?

If so, how do I accomplish that?

Thanks!
Victor

Igor Tandetnik

unread,
Sep 21, 2006, 11:54:41 AM9/21/06
to

Not as far as I can tell. You can write a COM DLL and configure the
button to call an object in it. The object could then run the EXE with
the command line.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


v...@ausi.com

unread,
Sep 21, 2006, 2:26:55 PM9/21/06
to
Igor Tandetnik wrote:
> >
> > Now, I would like to be able to pass to my .exe program some parameter
> > that would identify that particular instance of IE window (in a case
> > that there are more than a single IE window open).
> >
> > Is this possible?
>
> Not as far as I can tell. You can write a COM DLL and configure the
> button to call an object in it. The object could then run the EXE with
> the command line.

Thanks, Igor.

So, I understand that if I use that button to call an object in the COM
DLL (instead of simply invoking an executable), I can actually pass a
paramater to that COM object, right?

If so, could you point me please to an online article that describes
how to accomplish that?

Thanks!
Victor

Igor Tandetnik

unread,
Sep 21, 2006, 3:07:13 PM9/21/06
to
v...@ausi.com wrote:
> So, I understand that if I use that button to call an object in the
> COM DLL (instead of simply invoking an executable), I can actually
> pass a paramater to that COM object, right?

No. But the COM object has access to IWebBrowser2 of the hosting
browser, the DHTML DOM of the page currently displayed and so on. So it
can collect all the necessary information itself.

v...@ausi.com

unread,
Sep 21, 2006, 3:36:45 PM9/21/06
to
Igor Tandetnik wrote:
> v...@ausi.com wrote:
> > So, I understand that if I use that button to call an object in the
> > COM DLL (instead of simply invoking an executable), I can actually
> > pass a paramater to that COM object, right?
>
> No. But the COM object has access to IWebBrowser2 of the hosting
> browser, the DHTML DOM of the page currently displayed and so on. So it
> can collect all the necessary information itself.

OK. I got it.

But how does the COM object which of the open IE windows is the hosting
one? I mean: every open IE window has its own instance of IWebBrowser2,
right?

Thanks,
Victor

v...@ausi.com

unread,
Sep 21, 2006, 4:37:44 PM9/21/06
to
v...@ausi.com wrote:
> But how does the COM object which of the open IE windows is the hosting
> one? I mean: every open IE window has its own instance of IWebBrowser2,
> right?

Sorry, I meant to write: How does the COM object *know* which of the


open IE windows is the hosting one?

Thanks,
Victor

Igor Tandetnik

unread,
Sep 21, 2006, 5:33:02 PM9/21/06
to
v...@ausi.com wrote:
> But how does the COM object which of the open IE windows is the
> hosting one? I mean: every open IE window has its own instance of
> IWebBrowser2, right?

Implement IObjectWithSite on said COM object. Soon after creation,
SetSite will be called on it and given an IUnknown pointer. Query this
pointer for IServiceProvider, call QueryService(SID_SWebBrowserApp), and
you will get back IWebBrowser2 pointer referring to the browser instance
where the button was clicked.

0 new messages