Interact with Internet Explorer find window from code behind - c#

We have a WPF application that uses a System.Windows.Controls.WebBrowser control embedded in the window to link to our intranet.
The application is used on our EPOS units running Windows 10 LTSB. This limits us to using Internet Explorer only. As there are no keyboards attached, we use a WPF keyboard integrated into the application and send keypresses using InputSimulator.SimulateKeyPress(VirtualKeyCode).
All of this works extremely well and has been used for several years now.
However, we are wanting to add text search functionality to the application. The easiest way we thought of utilising this was to send a CTRL-F to the browser to open the browser find window.
The problem we have with this is that Internet Explorer creates a new window for find, this floats externally to our application so we cannot gain focus on it while using our on-screen keyboard.
What I think I need to do is to get a handle to this new window so, when processing key presses, we can direct them somehow to the find window, but I have no idea of how to achieve this!
Can anyone please help?

Related

Manage Alt+Tab in .net application

I am developing a simple chat application which works in LAN. I have a problem in ALt+Tab.
When I open 2 applications (One is mine and another one say Firefox), now it switches properly between two windows when I press Alt+Tab.
Now I will minimize firefox. So now my app is the only one in foreground. Now if I press Alt+Tab, firefox comes foreground which is not expected (or I dont expect).
How to make Alt+Tab not work when all windows are in minimized state ?
I am using vb.net but c# is also OK for me and for example I have given firefox; there may be n number of windows in minimized state.
Please help me.
Pressing ALT + TAB in Windows (or other OS) is supposed to switch between every active application that is running and has a top-level Window. So the behavior you are describing is actually working the way it is supposed to.
More on Wikipedia about that.
However, it is possible to hack this behavior by capturing the ALt-Tab event. It is actually used by several remote control application so they can transmit commands from one computer to another.
Here is a start up guide, but beware that you get into Windows weird APIs and low-level functionnality. Use at your own risk...

ActiveX Control created in .NET when hosted in IE doesn't recieve keyboard events

I've been writing an ActiveX plugin for IE using .NET. While I've happily got it to deploy, install and what not, I'm finding that IE isn't passing keyboard events to it.
Is there a way to get IE to pass along keyboard events to it?
This problem has been seen to happen on IE7 and IE8, haven't tested other versions of IE though, mainly because I'm using IE8 and the customer will be using IE7.
Thanks in advance.
Edit:
In this case the particular keys I'm interested in are the delete key and the end key
This is a problem with how the browser loads and exposes the object.
As a security measure, some objects will not be activated, until clicked on, and then receive keyboard input.
I actually found a solution Using JavaScript, to pass the characters to the ActiveX Object, so that you do not have to click on it first, to activate it.
I used it for a bar code scanning solution, as there was no keyboard or mouse attached to the device.
Silver light out of browser mode, made the keyboard input available straight away, and became a better solution. Not sure if the latest version still allows it.

How can i programmatically manipulate the Windows 7 on-screen keyboard osk: Move, Resize, Remove Titlebar/Caption

I'm working on a WPF app where i want to display the built-in windows 7 onscreen keyboard in a 'always there' manner. So i want to:
Move it to a particular location
Set it to a certain width and height
Remove the caption/titlebar so the user can't move it around or close it
Remove that abilty to resize it (or any other user adjustments for that matter).
I've tried all the typical API functions (MoveWindow, SetWindowPos, SetWindowLong, etc...) but it refuses to do anything. Code currently works with all other processes and apps (such as internet explorer and the command prompt); it's almost as if the api calls don't apply to the osk, or that it's 'locked'. What am i missing? Thanks in advance.
I checked with Spy++ and the On-Screen Keyboard uses something called "DirectUIHWND". You may wish to look into DirectUIHWND APIs.
A possibly helpful link:
http://www.codeproject.com/KB/COM/cominterfacehookingpart.aspx
In addition, some people have warned that DirectUI is undocumented.

Windows aplication that lives only in the taskbar

I'm new to windows programming (any win 32 API).
I want to create a windows application that listens to the clipborad all the time and reacts to keyboard shortcuts (for example you copy text from the ClipBoard and press Ctrl-F and something is done on the text in the clipboard).
I know how to make a window app in win32 and in C# (.NET) but it's a windowed application which has a window and appears in the window panel.
I want an pplication that will only be visible in the taskbar right part so you can close it (like most antivirus do) and keeps on running from start will it's closed.
Anyone got some code template, or can reffer me to a tutorial ? i don't mind if it's C\C+ or C#.
10x.
It can be another windows application in which the form's ShowInTaskbar property is set to false and you add a NotifyIcon component to put it into tray. Here is an article from CodeProject. You can find many more on codeproject or on other programming related sites.
You may find this useful, although it's in C.
Or this in C#.

How do i close all open windows from my C# program?

Hi i have a windows application where i show a webbrowser, i have a button that removes the browser (its a preview) and goes to another "view" in my application (another tab). My problem is that my users are getting advanced, they build HTML with links (and its ok) but the links may spawn new browser windows (IExplorer), and my button needs to close these windows, but how?
I have made some code to traverse all eht windows that ends with "Windows Internet Explorer", ahd it all seems to work - but how do i close them? I am trying to do it like this:
SendMessage((int)hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
It seems to work, but the browser pops up a dialog asking me if i want to close the tab of all the tabs...how to work around/solve this?
Cheers,
walking over all top level iE windows and closing them is a bad idea, unless you are guaranteed users can't launch ie and browse the Internet on their own. Otherwise, you might actually lose user data (say an email or a blog post the user has been working on in the last half an hour)
You can't easily work around that dialog without modifying the per-user IE settings. Your other option is to look for that dialog and click the yes button, but that would be fragile and is not guaranteed to continue working if the user upgrades to IE9.
You could potentially prevent opening links in new window by listening to BeforeNavigate event and allowing only navigations that are guaranteed to happen in your control. However, there are scenarios where IE might still decide to open new window.

Categories