Citrix Seamless users may experience Focus issues when using some applications that set the FOREGROUND LOCK Timeout to a value other than 0. Some of the behavior that might be experienced is when changing the focus to a Seamless application window by performing actions like Alt+Tab or clicking on the Seamless application’s taskbar icon, the intended window does not move to the foreground and might not be in focus. You may also see the Seamless application’s taskbar icon blinking.
When troubleshooting Seamless application focus issues, the following steps should be taken to verify that the issue is indeed caused by a process changing the FOREGROUND LOCK Timeout to a value other than 0.
1. Use the fglocktimeout.exe utility in this article.??
- Run the program inside the same session as the one where the ?? focus issue occurs.??
- If the FOREGROUND LOCK Timeout value is not zero, then this is most likely the root cause of the focus issue. It is important to ensure that the tool is running inside the same session as the Seamless published application. In order to do this, you should first launch the Seamless published application, then launch the tool as a second session shared published application, or you can do a Control F1 from the Seamless published application session and run the server session task manager to then launch the tool.??
- Example Output:??
TWI: FOREGROUND LOCK Timeout value is 4517412
2. Check with the application Developer/Vendor to see if they use the following MS API to change the FOREGROUND LOCK Timeout value:SystemParametersInfo( SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (PVOID) 0, SPIF_SENDCHANGE );
3. A possible workaround is to run the fglocktimeout.exe utility after a problematic application changes the FOREGROUND LOCK Timeout value. To do this, run the fglocktimeout.exe utility specifying the /z option. This sets the timeout value to 0 pragmatically.??
TWI: FOREGROUND LOCK Timeout value is 4517412??
TWI: z option - Set to 0 programmatically. Now FOREGROUND LOCK Timeout value is 0.
4. Another possible workaround is to use MMhook to catch the MS API that changes the FOREGROUND LOCK Timeout and prevent it from changing it to a non-zero value. If the application causing the problem is SQL Server Management Studio (SSMS), you can add the following Registry key (the value must be hexadecimal): [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\CtxHook\AppInit_Dlls\Multiple Monitor Hook] "Ssms.exe"=dword:00100080
After a Seamless session is launched, if another process changes the FOREGROUND LOCK Timeout to a non-zero value then it will result in focus problems for Seamless published apps.
By design when a Seamless application is launched the server side Seamless engine sets the FOREGROUND LOCK Timeout value to 0. If the published application changes this to a non-zero value, it will prevent the SetForegroundWindow API from being called by the Seamless engine to satisfy requests to change the foreground window.
Running a CDF Trace on the Server Seamless engine may show calls to the Microsoft API SetForegroundWindow API constantly failing error:
Error: Unable to set window 0x000000000001004E as the foreground window. [ nForegroundLockTimeout=200000 milliseconds ]
The issue has been reported with some applications such as Visual Studio, Sage Act and SQL Server Management Studio (SSMS) but might also occur with custom applications.