0

I'm wondering if anyone has any experience using JNA to call windows sendMessage API from a java web application running in a browser to change the focus from the browser to another program that is already running on the computer.

I'm building out a Parts catalog that once the user has chosen the parts they want to sell to the customer, I need to automatically open the Point of Sale system so that the employee can tender the transaction. They want this to happen on some event in the parts catalog, not just an ALT-Tab or something similar. I believe the registers run some sort of kiosk version of XP and the browser (Probably going to be Firefox 5), so some of the functionality, like the task bar and start menu, etc. are not there. Maybe JNA and the windows API is the wrong way completely. Any help or direction would be greatly appreciated!

2
  • Wouldn't there be sandbox issues with this? Commented Sep 22, 2011 at 21:41
  • I'm not sure what you mean by sandbox issues? It'd definitely be a bit hacktacular, assuming I can figure out a way to make it work. Commented Sep 27, 2011 at 13:35

1 Answer 1

1

A straightforward method would be to enumerate the extant windows until you find the one you're looking for, and then invoke the appropriate win32 method to activate/focus that window directly.

Sign up to request clarification or add additional context in comments.

2 Comments

Can you elaborate on this a little bit. Maybe point me to some resources that might give some examples of this implemented? Thanks!
There's an example at github.com/twall/jna/blob/master/www/CallbacksAndClosures.md which does the win32 window enumeration with a callback. Within the callback, figure out if the window just passed is the one you want. As for activating/focusing the window, a quick search on MS dev ought to show you the right API function to call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.