Show Contents / Index / Search

Get the View that has Focus

This sample program gets the host session document that has focus in the Reflection 2011 workspace by getting the view object for that session.

Note: This program works only with host session documents; not Web page documents.

To get the view that has focus in the Workspace

  1. Start Reflection 2011, and create two or more session documents that connect to different hosts.
  2. In Visual Studio, create a new Console Application project.
  3. In the New Project dialog box, type Get View in Focus in the Name field.
  4. Select the Create directory for solution box, click Browse to select your API projects folder (for example, C:\MyProjects), and then click OK.
  5. In Solution Explorer, add the class assemblies. (For instructions, see Create an API Project.)
  6. Copy the code from one of the following programs:

    Get the View in Focus (IBM)

    Get the View in Focus (OpenSystems)

  7. In Visual Studio, paste the code to the Program.cs tab, replacing all existing code.
  8. Build the application (Build > Rebuild Solution) and then run it (Debug > Start Without Debugging).

The host address of the selected session should display in the console. If you select a different session in the Reflection 2011 workspace and then run the program again, a different host address will display in the console.