Jump to content
The simFlight Network Forums

Recommended Posts

Posted

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.

Thanks,

Paul

 

Posted
1 hour ago, Paul Henty said:

My user has solved the problem using Win32 calls to ShowWindow and SetForegroundWIndow

I'm pretty sure this is what that control does too! But I'll cross-check.

Pete

 

Posted

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.

Pete

 

Posted

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):

FSUIPC5150g.zip

Cheers,

John

Posted

Hi John,

Thanks for looking at this. I don't have P3D so I can't give you any feedback on it, but it sounds like you've seen exactly the same problem and fixed it.

Paul

  • 3 years later...
Posted
22 hours ago, Alhard Horstmann said:

how can I set the focus on P3D undocked View , e,G.:  View 03  ?

FSUIPC only knows the window handle of the main P3D window, so it is not possible to give the focus to any other P3D window I'm afraid.

John

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.