Send mouse events to inactive and hidden windows/WPF forms - sendmessage

I'm developing an app that needs to generate mouse events on a window Win32/WPF which may be minimized or hidden from view on the desktop.
I have tried the user32.dll APIs SendInput, SendMessage, PostMessage etc. These work only if the window is visible on the desktop. Would you know about any methods that work for hidden/inactive windows?
I've also tried .NET's UI Automation library. In this case, a window is brought to the front or I'm not able to get a clickable point for the control.
Any ideas how I can proceed? If I can proceed?

I don't know if you're still interested in an answer (I just stumbled upon this question out of sheer dumb luck), but have you tried making a global windows hook?
I have no honest idea on how to properly go about implementing one; but I know you should be able to add a global windows hook to, well, Windows, to listen for whatever events you want (should include mouse and keyboard events!)
Good luck...

Related

When will SpeechSynthesis.speak work on iOS Safari?

I've been exploring the limits on SpeechSynthesis.speak on iOS Safari. I believe the current rules are more restrictive than there were in the recent past.
Are the rules documented anywhere?
These are the rules that I think apply.
Speak in direct response to a click on a <button> always works.
After the initial speak initiated by a button click additional speaks are allowed on the same page. They may be triggered programmatically by timers or whatever.
Initial speak on a change/input event does not work.
Initial speak on a click event on a <tr> does not work.
Any change of page, relative or not, puts you back to square one requiring a direct user action.
When a speak is suppressed you don't get any events nor any error indication.
You want tell if the speak was suppressed by watching for SpeechSynthesis.speaking and timing out if it isn't seen after some delay.
Are these consistent with your recent experience?
I've been testing on BrowserStack watching the events that get fired to determine which cases work.
I can confirm that you can't use SpeechSynthesisUtterance programmatically without a user action before. In my case I have in my web app a button to enable/disable audio, if the user enable the audio and later I try to speak something, it doesn't work
To solve it I had to trigger a fake speak (empty text new SpeechSynthesisUtterance('')) right after the user click on enable audio and then the audio works during all the session.

Instagram in app browser is shifting all click events

On the iPhone's Instagram app browser(in app) if you open a website that includes html inputs of any type, something strange happens.
In the beginning everything is working, but once you tap an input and type something ( and the keyboard is opened), after you close the keyboard you can't click on anything anymore because all buttons/inputs/elements are clickable in a different location than where they showed ( button is showed in the original 100px location but click events are now on 50px).
It looks like after the keyboard opens the whole location calculation is shifted up(because the keyboard pushes the whole body up)
How to even begin to debug such thing ?
Honestly, I've been there. There is no way to debug the in-app browser (you can try on an iphone device mirroring with Chrome in MAC, but you will eventually fail), but I've tried without success.
It turned out that after digging around with similar issues, there was a caching issue and some disabled features with WP ENGINE from my client. They were able to fix it by allowing some parameters on nginx settings and then the In App browser wasn't stucked anymore.
I know every issue is different, but at this time, I haven't found a way to debug the In - App browser.
I can't speak to iOS specifically, but there definitely are ways to remote debug things.
My go-to for stuff like this (speaking from experience of browsers on gaming consoles) is Weinre: https://people.apache.org/~pmuellr/weinre/docs/latest/Home.html You get something similar to Chrome Developer Tools, but it works over a Socket.IO connection.
Another tool I like to use is Fiddler. While it won't help you with your DOM issues, if you ever need to debug network stuff on oddball devices, it's perfect. It serves as a proxy server and can intercept all your connections, including HTTPS. https://www.telerik.com/fiddler
Turns out, that it's a fixed position and it's not supported, which means when keyboard is closed, the system will push back the whole view but click events stay up (because it's being pushed up when you open a keyboard).
So instead of make it an absolute modal, which has it's own problem, we keep it fixed, BUT, we do the pushing up/down by our own.
We could just push the screen back down on input unfocused, but if user click the next field you get unwanted behavior, so we create a delay based machine like so :
var isfocused=0;
var focusTimer=0;
$("input").blur(function() {
isfocused=0;
focusTimer = setTimeout(focusDone, 150);
});
$("input").focus(function(){
isfocused=1;
});
function focusDone(){
if(isfocused===0)
$(window).scrollTop(0,0);
clearTimeout(focusTimer);
}
This works great on social browsers, with fixed positioned modals that has inputs inside them.

Flash standalone player resize event stops firing

this is a weird one.
In our Flash project, we add a listener for stage resize events so we can do some dynamic resizing. At the moment we're not running it in a browser, just testing it in the standalone Flash player, and it has been working fine but recently, for some reason the events are no longer being triggered. What's odd is that it appears to be something code-related because when I switch over to a different chunk of code, the events still trigger - but I can't see any reason for it. The listener is still on the stage and its willTrigger is still true.
I know this is all a bit vague, but any suggestions would be valuable!
Again, just to be very clear, I'm not talking about running it in a browser, so this isn't anything to do with setting the resize settings in HTML.
Thanks
Well, if it were an AIR app i would suggest adding your event listener to NativeApplication.nativeApplication instead of the stage, a long time ago i had a similar intermittent problem and that was the fix. However i think thats only available for AIR. You can try to change your publiah settings to an AIR app just to see if it works. If it still doesnt work id have to assume its something code related on your part. willTrigger sounds suspicious :)

Air Native Window Active Window Change

I have a Adobe Air app (AS3, not Flex) that has 2 windows. When I click away from them onto another desktop program, I get an "Deactivate" Event (as you would expect).
When I click on say Window#1 I get an "Activate" Event (as you would expect).
But when I go from Window#1 to Window#2, I get nothing. And I believe this is because the Air application is still the active program, Just a Different Window.
But I have the need to know when I go from 1 window to another.
The horrible solutions I have come up with so far is to have an onEnterFrame and check if the current window is the active window. But I would much prefer to do it a much better way that such a hack.
I have gone though Stage, NativeApplication and Native Window Events and none of them do what I need. Can anyone point me to another Event I may have overlooked?
Listen for window activation events directly on the NativeWindow object. (All display objects dispatch activation/deactivation events, but these are triggered by the application -- or SWF object in the browser -- getting or losing the OS focus.)

using PopUpManager in a Flex 4.5 Mobile App

This is more of a best practices question rater than something technical.
I'm working on a mobile app using the Flex 4.5 SDK and I'm trying to figure out the best way to handle notification windows. In most cases these windows will be alerting the user to when something goes wrong. Ex: bad login, no data, cannot resolve server.
I'm using a singleton design pattern, I have a Requests class that handles server calls. Most popups will be originating from this class (IOErrorEvents from my loader being used to access the API). Since this class is a singleton and is used from all Views inside the app it is not aware of applications current view. I'm also not sure having this class keep track of the current view and having it push popups on top of it would be best practice.
I'm hoping that I can use PopUpManager to keep track of where to add popups and what popups are currently on the stage. Though all examples I've seen online about this show static Components being used in a views Declarations tag.
I'm really just looking for any examples or input on how you would solve this problem. Any help would be greatly appreciated!
I had the same problem, and sorted it by making an Alert popup component that you can call from anywhere in the code base, and it will pop up in the currently active window. It also has an always visible scrollbar text area which is handy
http://bbishop.org/blog/?p=502
It works for a view navigator application, but if your using a tabbed navigator application, you can add a call for that, or simply change the code to
mainTabbedNavigator = FlexGlobals.topLevelApplication.tabbedNavigator;
currentTab = mainTabbedNavigator.selectedNavigator as ViewNavigator;