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
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
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
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
Sorry, I meant to write: How does the COM object *know* which of the
open IE windows is the hosting one?
Thanks,
Victor
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.