Jump to content
The simFlight Network Forums

Key Focus Restore control (1125) in FSUIPC5

Recommended Posts

Hi Pete,

One of my users is having problems with restoring focus to P3D (V4.4) from my DLL. I don't have P3D so I can't test it myself.

My DLL makes use of control 1125 (Key Focus Restore) which works fine for FSX.

The user experiences a flashing P3D icon in the task bar, but the P3D window doesn't actually get focus or jump to the foreground. The P3D window is not minimised.

Can you please check this in FSUIPC5 and see if it works okay?

My user has solved the problem using Win32 calls to ShowWindow and SetForegroundWIndow but I'd rather stick to issuing the FSUIPC control if possible.




Link to comment
Share on other sites

Actually, FSUIPC uses "SetFocus" followed by "SetForegroundWindow".   This has always worked fine.  Not sure what a "flashing icon in the taskbar" means.

Anyway, I've just tested it with P3D4 in a Window and a button assigned on a joystick device to Key Focus Restore. I go to a different window on my desktop (one overlapping with P3D4 as it happens), and pressing the button puts the P3D4 Window on top AND gives it keyboard focus. This works every time.

Now I am using a later Beta version of P3D4 that the one currently released, so maybe it was a P3D4 prblem now fixed. Seems more likely, though, that it is somehow related to something his program is doing. The flashing icon sounds suspiciously like there's something taking focus back when FSUIPC tries to set it.



Link to comment
Share on other sites

Hi Paul,

I had a look at this as I was experiencing the same problem about 80% of the time. However, I noticed that if I hit the button twice, the first will flash the icon and then the second press will set show and give focus to the main P3D window. I've therefore made a small update, removing the SetFocus call (not really needed with 'SetForegroundWindow') and calling 'SetForegroundWindow' twice with a short delay in between. A bit of a hack but seems to work.

I've also added a call to 'ShowWindow' which will un-minimize the window if it is minimized.

The update is in the dll attached (zipped):




Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.