Forum

ShowWindow not working with vvvv window

hello,

i can’t get ShowWindow to bring vvvv back into focus with DoBringToTop.

instead of switching the focus back, the vvvv icon starts blinking in the windows taskbar.

see attached patch for a demonstration.

ultimately i want to show a chrome browser in kiosk mode and have the possibility to close it again with a mouse click on a small, borderless dx9 renderer that is shown after some seconds of inactivity.
no keyboard available as it runs on a touch screen.

everything seems to work alright, except for getting the focus back to vvvv.

happy to hear about alternative solutions, maybe its possible to show chrome kiosklike while leaving some pixels on the bottom for the close button?

sadly, html texture is not suitable for various reasons.

and…this is kind of urgent.

thanks

edit: changed to bug in hope to get some attention…

focus-test-3.v4p (15.7 kB)

so i’ve been testing this on another system.
at first it behaved as described, but then it kind of just worked.
i was able to break it again by just switching programs, and now it’s working perfectly solid.

now i feel betrayed by whatever is causing this.

i tried various update periods for the windows list but this doesn’t seem to make a difference.

also, i recall it working on the production system for a while (mac mini with bootcamped win7)

here’s the fix:

regedit - currentuser - control panel - desktop
ForeGroundLockTimeout - change value to decimal 0

seems to work so far, hope it stays like that.

preemptive flagging.

so while the above change makes it work, there still remains an underlying problem with the windows api.

sometimes it is not possible to set the focus because the currently focused process insists on keeping it.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633539%28v=vs.85%29.aspx

the problem is that the fight for focus will never be settled (vvvv icon in taskbar is lit), until the user clicks the icon with the mouse.

so theres still quite a good chance to break stuff unrecoverably, if that is a word.

so, i’m still hoping for some suggestions. especially how to break out of the focus limbo situation or to definitely prevent this state.

btw, a good chance to break the focus is to press the windows key!

any idea for a workaround?

is it possible to detect the focus conflict and simulate an alt+tab?

Maybe you could kill chrome instead of just switching focus? And then start it up again using shell execute…

with your demo patch it is not working for me in windows8.
Could this just be because MS switched a lot of this kind of windows behaviour in Win8? Or are you having the problems in Win7 aswell?

I find Messing with Windows very problematic for applications and vvvv - maybe you could go another way.

We did almost the same, but ended up writing it in a small C# / WPF application to avoid using the window list and the issues within.

hey bjoern,

i open and kill chrome with shell execute already.
the focus switch shows a dx9 menu with a back button.
pressing the button kills chrome.

so killing it could be a kind of last resort, but first
i would have to be able to tell when this is needed.

thanks for replying, i started to fell a bit lonely here already.

ether,

i’m on win7 and right now things are looking pretty ok.

i would love to go another way, but this is already the 3rd route i’m going with this after trying html texture and html renderer.

as to avoiding the windows list: i thought about that as well and actually am able to do without it by just relying on the fact that the name of the renderer will never change.

but as far as i can tell this is not what’s causing problems.

the registry switch really made the difference for me, but the
windows api restrictions still make me nervous. (see msdn link above)

so now i’m checking if there is any IO stuff going on before daring to ask for a focus switch.

edit: i marked the regedit as the solution as it seems to hold up for what i was hoping to achieve. thanks for your help.

don’t mess with windows!