Build the Custom Application
- In Reflection 2008, create two documents: a Web page document set to www.MSN.com and a session document.
- Save the documents, noting their filenames and paths, and then quit Reflection 2008.
- In Visual Studio, create a new Windows Application project.
- In the New Project dialog box, type Integration in the Name box.
- 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:
Main.cs (IBM)
Main.cs (OpenSystems)
- In Solution Explorer, rename Form1.cs to Main.cs, right-click Main.cs, choose View Code, and paste the copied code, replacing any existing code.
This code defines the m_application variable, as follows:
private Attachmate.Reflection.Framework.Application m_application;
This code also provides the easiest and most reliable way to reference a Web element the ID:
IWebElement searchbox = m_WebDocument.GetElementById("f1")
- In the code:
Locate the line that starts
|
And do this
|
m_terminal= (IIbmTerminal)
-or-
m_terminal= (ITerminal)
|
Edit the path to match the location of the session document you saved in step 1.
For example, if you created a 5250 session named test.rd5x on Windows Vista, edit the path to read as follows:
(@"C:\Users\user_name\Documents\Attachmate\Reflection\test.rd5x");
|
m_webControl= (IWebControl)
|
Edit the path to match the location of the Web page document you saved in step 1.
|
- Copy and paste code from the following four .cs files:
Copy the code from
|
And then in Solution Explorer
|
MainDesigner.cs (IBM)
-or-
MainDesigner.cs (OpenSystems)
|
Double-click Main.Designer.cs and paste the code to the Main.Designer.cs tab, replacing any existing code.
|
Program.cs (IBM)
-or-
Program.cs (OpenSystems)
|
Double-click Program.cs and paste the code to the Program.cs tab, replacing any existing code.
|
ProgressBox.cs (IBM)
-or-
ProgressBox.cs (OpenSystems)
|
Right-click the solution node ("Integration"), add a Windows Form item, and then name it ProgressBox.cs. Next, right-click ProgressBox.cs, choose View Code, and then paste the copied code to the ProgressBox.cs tab, replacing any existing code.
|
ProgressBox.Designer.cs (IBM)
-or-
ProgressBox.Designer.cs (OpenSystems)
|
Expand ProgressBox.cs, double-click ProgressBox.Designer.cs, and paste the code to the ProgressBox.Designer.cs tab, replacing any existing code.
|
- Build the application (Build > Rebuild Solution) and then run it (Debug > Start Without Debugging).
The program starts Reflection 2008 and opens a Windows Form application interface that contains two buttons and three text boxes.
|