How to force a delphi form to be in foreground in windows 10 tablet mode -


this setting:

i have 2 views implemented within 2 different vcl forms. 1 of applied style make touch optimized metro app. forms can switched according application's setting. (show touch optimized view on/off)

this works pretty good. override application.mainform, old form closes, new form appears (and takes focus).

i want automated in windows 10. additional view mode offer option "auto detect":

  1. i listening windows message wm_settingchange. sent switching between desktop mode , tablet mode.
  2. then check registry value of hkey_current_user\software\microsoft\windows\currentversion\immersiveshell\tabletmode
  3. if it's 1 switch touch optimized view.

and problem:

the old form destroyed, new form pops , application.mainform references new form. buf afterwards start screen of tablet mode pops , shows on top of windows. new touch optimized form disappears behind screen , loses focus. behavior doesn't appear if set view fixed desktop view , switch windows 10 tablet mode. in case, application keeps focus , maximizes (that way there's no form created of course).

what i've tried far:

  1. the obvious approach call of application.mainform.bringtofront.this doesn't work.
  2. my second approach create hidden "helperform" takes formstyle := fsstayontop (this way focus should taken) , calls setforeground(application.mainform.handle) winapi.

any ideas?


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -