Set Focused application in session

Nov 22, 2010 at 5:51 AM

Hello.

After session oppening, I want to set focus on specific application. I tried some things, but they didn`t work.

Can anyone help me please ?

Vahag.

Nov 22, 2010 at 1:57 PM
Edited Nov 22, 2010 at 1:58 PM

In any control with the interface IDesktopUserActionsConsumer will get a pointer an Interface called IDesktopUserActions. In that interface you will find a command SetFocusOnApplication(appName). When called, this will set the focus on the application name you specify ( that’s the tab name ).. if the App is found and the command is executed properly you get a True back, else a false.

*** You can also add the interface IDesktopUserActionsConsumer Interface to your Hosted control or Adapter… you will find it in the Microsoft.Uii.Desktop.Core assembly. ***

You can also access that method from the desktop itself, though I would discourage it, using the instance of WinformsDesktop or WPFDesktop ( Or this. Depending on how you built your shell.

If you do use it from the desktop, make sure you do it after the Desktop Loading Completed event is fired our your command will get overridden by the load order of the Apps as the desktop boots.

MattB - MSFT

Nov 23, 2010 at 4:33 AM

Thank you Matt a lot.
This has solved my problem.

Vahag.

Dec 22, 2011 at 10:15 AM
Edited Dec 22, 2011 at 10:45 AM

Hi Matt,

            I have followed what you have detailed above, but I can't get focus of the application.

The DESKTOP LOAD COMPLETE EVENT is not FIRED in my case.

Abish