I want to get the find dialog (Which opens with a control + F) as an object, for to know if it's active.
How I do it?
I went through all the parameters of the web browser control and found nothing.
I want to get the find dialog (Which opens with a control + F) as an object, for to know if it's active.
How I do it?
I went through all the parameters of the web browser control and found nothing.
Neither the WebBrowser control, nor the native IWebBrowser2 interface expose the find dialog. The only interaction is launching the dialog by calling an OLE command:
SHDocVw.WebBrowser webBrowserInstance = webBrowser1.ActiveXInstance as SHDocVw.WebBrowser;
webBrowserInstance.ExecWB(
SHDocVw.OLECMDID.OLECMDID_FIND,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT,
null, null);
This works well, but neither can you pass any variables, nor do you get any back. The find dialog unfortunately isn't a child window, and it doesn't have any identifying classes or attributes. Basically you'd need to inspect all top-level windows belonging to your process, and find out if one of them is the dialog in question. Then you can send a WM_CLOSE to the window, or call CloseWindow, or somemthing similar.
There is a good collection of functions to search for (top-level) windows belonging to a process here: How to enumerate all windows belonging to a particular process using .NET?