SetViewerInFocus is a built-in scripting function that moves the project viewer in front of all other open windows and then maximizes it to fill the display.

Function Group Execution Windows Embedded Thin Client
SetViewerInFocus Module Activity Synchronous Supported Not Supported Supported



There are no parameters.

Returned value

This function does not return any value.


Beginning with Windows XP, system security features prevent program windows from moving themselves in front of others without user input. As such, when you call this function, the Viewer program will request the user's attention by blinking in the Windows taskbar. (Some anti-virus software may also flag this as suspicious behavior.) Only when the user selects the program will the program window move to the front.

To work around this, you must call SetViewerInFocus at least once in your project's Startup Script. Allow twenty seconds more for your project to finish starting up, and then after that, any additional calls of this function should work normally.