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
- Start Reflection 2011, and create two or more session documents that connect to different hosts.
- In Visual Studio, create a new Console Application project.
- In the New Project dialog box, type Get View in Focus in the Name field.
- Select the Create directory for solution box, click Browse to select your API projects folder (for example, C:\MyProjects), and then click OK.
- In Solution Explorer, add the class assemblies. (For instructions, see Create an API Project.)
- Copy the code from one of the following programs:
Get the View in Focus (IBM)
Get the View in Focus (OpenSystems)
- In Visual Studio, paste the code to the Program.cs tab, replacing all existing code.
- 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.