User Tools

  • Vistasource Document Library

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rtw_4.3:com_interface_guide [2011/09/06 21:42]
cjaeger [using a .zip file]
rtw_4.3:com_interface_guide [2018/08/04 20:09] (current)
Line 4: Line 4:
 ====== Preface ====== ​ ====== Preface ====== ​
    
-The Vistasource RTW COM Interface allows you to connect to and receive real-time data from  any  COM-based client ​ application,​ including Microsoft ​ +The Vistasource RTW COM Interface allows you to connect to and receive real-time data from  any  COM-based client ​ application,​ including Microsoft Excel. ​ The RTW COM Interface is a piece of middleware between the installed RTW engines or a custom engine built with the RTW Toolkit, ​ and a COM-based application. You can use a variety of data distribution systems (DDS), collect data from different sources, and publish the results through the DDS of your choice.  ​
-Excel. ​ The RTW COM Interface is a piece of middleware between the installed RTW engines or a custom engine built with the RTW Toolkit, ​ and a COM-based application. You can use a variety of data distribution systems (DDS), collect data from different sources, and publish the results through the DDS of your choice.  ​+
   ​   ​
  
Line 17: Line 16:
 |''​Text in Courier''​ | represents text typed into a command window or a code example.| ​ |''​Text in Courier''​ | represents text typed into a command window or a code example.| ​
  
-This manual contains cross-references ​to chapters and sections that can be accessed with a single click on the referenced ​chapter and section titles. ​+This manual contains cross-references sections that can be accessed with a single click on the referenced section titles. ​
  
 ===== Navigation =====    ===== Navigation =====   
Line 35: Line 34:
 COM Interface. It covers the following topics:  ​ COM Interface. It covers the following topics:  ​
  
-[[com_interface_guide#system_requirements|System ​requirements]] \\  +[[#​System ​Requirements]] \\  
-[[com_interface_guide#​Installing]] \\  +[[#​Installing]] \\  
-[[com_interface_guide#​Uninstalling]] \\ +[[#​Uninstalling]] \\ 
-[[com_interface_guide#​Licensing]] \\+[[#​Licensing]] \\
  
 ===== System Requirements ===== ===== System Requirements =====
Line 79: Line 78:
   - Read the License agreement, select **YES** to continue.  ​   - Read the License agreement, select **YES** to continue.  ​
   - Select a destination location for the software. By default the destination folder will be:  \\ //​C:​\Program Files\Vistasource\RTW\4.3//​ Click **Next** to continue.   - Select a destination location for the software. By default the destination folder will be:  \\ //​C:​\Program Files\Vistasource\RTW\4.3//​ Click **Next** to continue.
-  - On the  Select Components screen, choose to install ​ Vistasource RTW and the samples as well as any licensed RTW engine for your installation,​ click **Next** for the installation to proceed. Note:  The sample files provide a quick insight into the functionality of RTW COM Interface and will be referenced in this guide.  ​+  - On the  Select Components screen, choose to install ​ Vistasource RTW and the samples as well as any licensed RTW engine for your installation,​ click **Next** for the installation to proceed. ​\\ **Note:**  The sample files provide a quick insight into the functionality of RTW COM Interface and will be referenced in this guide.  ​
   - The installer will install the necessary files according to your choices in step 6 and then display a final screen. This screen will provide the option to review the product release notes.  ​   - The installer will install the necessary files according to your choices in step 6 and then display a final screen. This screen will provide the option to review the product release notes.  ​
   - Click **Finish** to complete the installation. ​   ​   - Click **Finish** to complete the installation. ​   ​
Line 108: Line 107:
 <​note>​Please make sure that Microsoft Excel is closed, when you run the Uninstall option in the Add/Remove program. </​note>​ <​note>​Please make sure that Microsoft Excel is closed, when you run the Uninstall option in the Add/Remove program. </​note>​
    
-Files that are not installed by the RTW installer will not be removed by it. If such files exist, ​ they will require manual removal from the  application ​ +Files that are not installed by the RTW installer will not be removed by it. If such files exist, ​ they will require manual removal from the  application directory.
-directory.+
  
 === To uninstall using the Windows Add/Remove Programs Utility === === To uninstall using the Windows Add/Remove Programs Utility ===
 +
  
 ==To uninstall the RTW COM Interface: == ==To uninstall the RTW COM Interface: ==
  
-  - Select Start -> Control Panel from the Windows taskbar.  +  - Select ​**Start -> Control Panel** from the Windows taskbar.  
-  - Double-click the Add/Remove Programs icon. +  - Double-click the **Add/Remove Programs** icon. 
   - The Add/Remove Program Properties dialog box appears. ​   - The Add/Remove Program Properties dialog box appears. ​
-  - Click the Change or Remove Programs tab.  +  - Click the **Change or Remove Programs** tab.  
-  - Select RTW.  +  - Select ​**RTW**.  
-  - Click Change/​Remove. ​+  - Click **Change/​Remove**
   - Windows prompts you to confirm the removal of this program. ​   - Windows prompts you to confirm the removal of this program. ​
-  - Click Yes. +  - Click **Yes**
   ​   ​
 === To uninstall using the RTW Install Wizard === === To uninstall using the RTW Install Wizard ===
 +
  
 == To uninstall the RTW COM Interface: == == To uninstall the RTW COM Interface: ==
  
-  - Select Start -> Run from the Windows taskbar. ​+  - Select ​**Start -> Run** from the Windows taskbar. ​
   - The Run dialog box appears. ​   - The Run dialog box appears. ​
   - Browse to the directory where the archive file was extracted and select SETUP.EXE. ​   - Browse to the directory where the archive file was extracted and select SETUP.EXE. ​
-  - Click Open.   +  - Click **Open**.   
-  - Select the Remove option in the dialog box that appears and click Next. A dialog box appears ​ requiring the confirmation of the uninstall process. After confirming the option, the uninstall process continues until the program is uninstalled.+  - Select the **Remove** option in the dialog box that appears and click **Next**. A dialog box appears ​ requiring the confirmation of the uninstall process. After confirming the option, the uninstall process continues until the program is uninstalled.
  
  
Line 139: Line 139:
 RTW, the RTW engines and the RTW COM Interface are licensed products of Vistasource,​ Inc. Please refer to license agreement. ​ RTW, the RTW engines and the RTW COM Interface are licensed products of Vistasource,​ Inc. Please refer to license agreement. ​
  
-For detailed information about setting up licensing, see the [[licensing_howto|Licensing HowTo]] ​+For detailed information about setting up licensing, see the [[licensing_howto|Licensing HowTo]] ​document.
  
 To purchase licenses, contact your local Vistasource Office or email [[rtwsales@vistasource.com]] for more information. ​ To purchase licenses, contact your local Vistasource Office or email [[rtwsales@vistasource.com]] for more information. ​
  
-Select Vistasource -> Help -> About to display the About dialog box for the RTW version number and Vistasource contact information. ​+Select ​**Vistasource -> Help -> About** to display the About dialog box for the RTW version number and Vistasource contact information. ​
  
-== LMTools ==+=== LMTools ​===
  
-Select Vistasource -> License Management to display the LMTools by Macrovision Corporation dialog box. This tabbed dialog box provides details about your license setup including options to stop and restart the license server. More information on using this tool can be found in the [[licensing_howto|Licensing HowTo]]+Select ​**Vistasource -> License Management** to display the LMTools by Macrovision Corporation dialog box. This tabbed dialog box provides details about your license setup including options to stop and restart the license server. More information on using this tool can be found in the [[licensing_howto|Licensing HowTo]] ​document.
  
  
Line 154: Line 154:
 The RTW COM Interface allows you to communicate with real-time engines from either a custom COM-based client application or from Microsoft Excel (including VBA).  The RTW COM Interface allows you to communicate with real-time engines from either a custom COM-based client application or from Microsoft Excel (including VBA). 
  
-This chapter ​provides an example of how to build a simple COM-based Visual Basic application that displays real-time data coming from a data distribution system using a Vistasource RTW engine. ​+This section ​provides an example of how to build a simple COM-based Visual Basic application that displays real-time data coming from a data distribution system using a Vistasource RTW engine. ​
  
 To see a working Visual Basic example, run the sample application "Quick Quote”, which is located in \\  To see a working Visual Basic example, run the sample application "Quick Quote”, which is located in \\ 
 C:\Program Files\Vistasource\RTW\4.3\Samples\ COM \Visual Basic\QuickQuote. ​ C:\Program Files\Vistasource\RTW\4.3\Samples\ COM \Visual Basic\QuickQuote. ​
  
-Please see [[#Creating a Quick Quote Application (Sample)]] for more detailed instructions on how to build this Quick Quote application in Visual Basic. The same information together with a Readme file on how to run "​QuickQuote"​ is located in the directory \\ +Please see [[#Creating a "Quick Quote" ​Application (Sample)]] for more detailed instructions on how to build this Quick Quote application in Visual Basic. The same information together with a Readme file on how to run "​QuickQuote"​ is located in the directory \\ 
 //​C:​\Program Files\Vistasource\RTW\4.3\Samples\ COM\Visual_Basic\ QuickQuote//​. ​ //​C:​\Program Files\Vistasource\RTW\4.3\Samples\ COM\Visual_Basic\ QuickQuote//​. ​
  
Line 166: Line 166:
 This section illustrates how to write a custom Visual Basic application using the RTW COM Interface. ​ This section illustrates how to write a custom Visual Basic application using the RTW COM Interface. ​
  
-Assuming that the RTW COM Interface is installed, and the COM Server is properly registered as described in Chapter 1 "Installing the RTW COM  +Assuming that the RTW COM Interface is installed, and the COM Server is properly registered as described in [[#Installing the RTW COM  
-Interface," ​the types associated with the COM Interface can be accessed in a COM-compliant language, such as Visual Basic, C++, MS J++ etc. +Interface]], the types associated with the COM Interface can be accessed in a COM-compliant language, such as Visual Basic, C++, MS J++ etc. 
  
-The RTW COM Interface provides the "​VSRtdServer 1.0 Type Library."​ The following three methods are exposed by the COM Interface for use by the  +The RTW COM Interface provides the "​VSRtdServer 1.0 Type Library."​ The following three methods are exposed by the COM Interface for use by the COM-based client: ​
-COM-based client: ​+
  
   * VSRTConnectData ​   * VSRTConnectData ​
Line 185: Line 184:
  
 |//​TopicID//​|is some unique value to represent your data request, e.g. 1234. | |//​TopicID//​|is some unique value to represent your data request, e.g. 1234. |
-|//​inStrings//​|is an array of topics. The order and nature of these topics is fixed and resembles those used in the RTD function for Excel: Command,​Engine,​Service,​ Record, Field1,​…Field n \\ \\ **whereby:​** \\ \\ topic1 (Command) = "​rt"​ for subscribing to data or "​rtinsert"​ for publishing data.(For additional commands and their corresponding arguments see Appendix A "​Additional RTW COM Interface Commands."​) \\ \\  topic2 (Engine) = Name of the specific RTW engine which manages the communication between the COM-based client and the data distribution system. \\ \\ Note: If topic1 (Command) is "​rtinsert,"​ then topic2 is the value to publish. Subsequent topics simply shift down. \\ \\ Note: To publish multiple values, topic2 must be a string, e.g. ''​{val1,​ val2,​…valn}'',​ whereby val1 corresponds to topic5 (Field), val2 corresponds to topic6 (Field) and so on. \\ \\ topic3 (Service name) = Name of the data feed/​service available from the data distribution system. In a Reuters environment,​ this feed name may be something like IDN_SELECTFEED or DDS. In Bloomberg, it may be TICKERX. \\ \\ topic4 (Record) = Name of the record of data to which you would like to subscribe or publish. \\ \\ topic5…n (Field) = The name(s) of the field(s) you are interested in within the record, such as BID or ASK. If only one field is specified, a single value is returned. If multiple fields are specified, multiple values are returned. If you choose "​rtinsert"​ as topic1, this field represents the value within the record you would like to publish. \\ \\ Note: For more information on how to code these topics, see the sample code later in this section. |+|//​inStrings//​|is an array of topics. The order and nature of these topics is fixed and resembles those used in the RTD function for Excel: Command,​Engine,​Service,​ Record, Field1,​…Field n \\ \\ **whereby:​** \\ \\ topic1 (Command) = "​rt"​ for subscribing to data or "​rtinsert"​ for publishing data.(For additional commands and their corresponding arguments see Appendix A "​Additional RTW COM Interface Commands."​) \\ \\  topic2 (Engine) = Name of the specific RTW engine which manages the communication between the COM-based client and the data distribution system. \\ \\ **Note:** If topic1 (Command) is "​rtinsert,"​ then topic2 is the value to publish. Subsequent topics simply shift down. \\ \\ **Note:** To publish multiple values, topic2 must be a string, e.g. ''​{val1,​ val2,​…valn}'',​ whereby val1 corresponds to topic5 (Field), val2 corresponds to topic6 (Field) and so on. \\ \\ topic3 (Service name) = Name of the data feed/​service available from the data distribution system. In a Reuters environment,​ this feed name may be something like IDN_SELECTFEED or DDS. In Bloomberg, it may be TICKERX. \\ \\ topic4 (Record) = Name of the record of data to which you would like to subscribe or publish. \\ \\ topic5…n (Field) = The name(s) of the field(s) you are interested in within the record, such as BID or ASK. If only one field is specified, a single value is returned. If multiple fields are specified, multiple values are returned. If you choose "​rtinsert"​ as topic1, this field represents the value within the record you would like to publish. \\ \\ **Note**: For more information on how to code these topics, see the sample code later in this section. |
 |//​GetNewValues//​| A Boolean value that is set to True. | |//​GetNewValues//​| A Boolean value that is set to True. |
 |//​Status//​| The return code. 0 indicates success | |//​Status//​| The return code. 0 indicates success |
Line 216: Line 215:
 <​note>​For brevity, the code on how to create a dialog box with the button and  <​note>​For brevity, the code on how to create a dialog box with the button and 
 entry field is skipped. If you are interested in stepping through an entire ​ entry field is skipped. If you are interested in stepping through an entire ​
-application,​ please see Chapter 4 "Publishing with the RTW COM Interface  +application,​ please see [[#Publishing with the RTW COM Interface  
-(Sample)" ​for more detailed information</​note>​+(Sample)]] for more detailed information</​note>​
  
- 1. In Visual Basic, click P**roject ​-> References…** to display a dialog box  that contains a list of available type libraries. The list should contain the  item "​VSRtdServer 1.0 Type Library."​ If it is toggled on, you can write  the following: ​+ 1. In Visual Basic, click **Project ​-> References…** to display a dialog box  that contains a list of available type libraries. The list should contain the  item "​VSRtdServer 1.0 Type Library."​ If it is toggled on, you can write  the following: ​
  
 <code vbnet>​Dim WithEvents vsrt_obj as VSRTDSERVERLib.VSControl</​code>​ <code vbnet>​Dim WithEvents vsrt_obj as VSRTDSERVERLib.VSControl</​code>​
Line 296: Line 295:
  1. Open Visual Basic. ​  1. Open Visual Basic. ​
  
- ​2. ​Select ​the standard EXE icon (Figure A). + ​2. ​Create a new project with the type '​Standard Exe', by selecting ​the standard EXE icon (Figure A). 
  
 **Figure A** **Figure A**
Line 304: Line 303:
  3. Before you begin to program, you must reference the Vistasource RTD Server library (VSRtdServer 1.0 Type Library). See Figure B.   3. Before you begin to program, you must reference the Vistasource RTD Server library (VSRtdServer 1.0 Type Library). See Figure B. 
  
- a. From the menu bar, select Project -> References ​ + a. From the menu bar, select ​**Project -> References**. \\
  b. Scroll down the list and check the box that has VSRtdServer 1.0 Type Library ​  b. Scroll down the list and check the box that has VSRtdServer 1.0 Type Library ​
  
Line 313: Line 311:
    
  
-4. Below is an example of a toolbox view. We will use aLabel, TextBox, CommandButton,​ and Combo Box for the QuickQuote Visual Basic Application. See Figure C. +4. Below is an example of a toolbox view. We will use a Label, TextBox, CommandButton,​ and Combo Box for the QuickQuote Visual Basic Application. See Figure C. 
  
 **Figure C** **Figure C**
Line 319: Line 317:
 {{com_3.jpg?​direct&​|}} {{com_3.jpg?​direct&​|}}
  
-5. Create a combo box on the form for the engine. Activate the Properties window: Select View Properties, or F4 or right-click on Properties. Change the button'​s (Name) Property to ENGINE. Create a Label next to ENGINE and change the (Name) to EngineLabel. See Figure D. +5. Create a combo box on the form for the engine. Activate the Properties window: Select ​**View -> Properties**, or F4 or right-click on **Properties**. Change the button'​s (Name) Property to ENGINE. See Figure D. 
  
 **Figure D** **Figure D**
Line 328: Line 326:
 Then change the style to the Engine ComboBox to 2 –Dropdown List.  Then change the style to the Engine ComboBox to 2 –Dropdown List. 
  
-6. Create the following 5 text boxes and 5 labels as described in the table below. Align the Text Boxes and Labels as in Figure E+6. Create ​a Label next to ComboBox and change ​the (Name) to EngineLabel ​and the Caption to Engine
  
 +7. Create the following 5 text boxes and 5 labels as described in the table below. Align the Text Boxes and Labels as in Figure E.  The text property for the Text Boxes and the caption property for the Labels will be set in the code.
  
  
Line 341: Line 340:
 **Figure E** **Figure E**
  
-{{com_5.jpg?​direct&​|}} ​+{{:​rtw_4.4:​step7_com_guide_44.jpg?​direct&​|}}
  
-7. Create two Command Buttons, ​one to GetQuote, and one to Close the QuickQuote dialog box. Your final form should look like Figure F. You can add graphics to the form. + 
 +8. Create two Command Buttons. For the first buttonset the (Name) ​to Quote and the Caption to Get Quote. For the second buttonset both the (Name) ​and Caption ​to Close. Your final form should look like Figure F. You can add graphics to the form. 
  
 **Figure F**  **Figure F** 
  
-{{com_6.jpg?​direct&​|}}+{{:​rtw_4.4:​step8_com_guide_44.jpg?​direct&​|}}
  
  
-8. To start programming,​ double-clicked anywhere in the form. You will get a code sheet. Before all the procedures, enter the following ​in the first two lines:+9. To start programming,​ double-clicked anywhere in the form. You will get a code sheet. Before all the procedures, at the top of the code sheet, enter the following ​three lines:
    
 <code vbnet> <code vbnet>
  Dim WithEvents vsrt As VSRTDSERVERLib.VSControl ​  Dim WithEvents vsrt As VSRTDSERVERLib.VSControl ​
- ​Dim ​Topic_IdAs ​Long  + ​Dim ​Topic_Id As Long  
- ​Dim ​MyEngineAs ​String ​+ ​Dim ​MyEngine As String ​
 </​code>​ </​code>​
  
-9Between ​the Private Sub Form_Load() procedure, declare the buttons values for the form above. So far, your code should look like+10To declare values for the form text boxes and labels, add the following code to the Private Sub Form_Load() procedure: ​
  
 <code vbnet> <code vbnet>
-Dim WithEvents vsrt As VSRTDSERVERLib.VSControl ​ 
-Dim Topic_IdAs Long  
  
 Private Sub Form_Load() ​ Private Sub Form_Load() ​
Line 391: Line 389:
 Chr(13) & "or you do not have a connection to RMDS ",​vbCritical,​ _  Chr(13) & "or you do not have a connection to RMDS ",​vbCritical,​ _ 
 "Error in Application headlines." ​ "Error in Application headlines." ​
-End +End Sub
 </​code>​ </​code>​
  
-10. Go back to the form, double-click on the CLOSE button. Type the  command Unload ​me inside the Sub Close_Click() routine. ​ This routine will bperformed ​when the user clicks on this button. Unload statement removes the named object from memory. ​+11. Go back to the form, double-click on the CLOSE button. Type the  command ​**Unload ​Me** inside the Sub Close_Click() routine. ​ This routine will performed ​when the user clicks on this button. Unload statement removes the named object from memory. ​
  
 <code vbnet> <code vbnet>
Line 402: Line 400:
 </​code>​ </​code>​
  
-11. Now double-click on the GetQuote ​button and enter the following  ​commands ​inside the Sub GetQuote_Click( ) routine: ​+12. Now double-click on the Quote button and enter the following  ​command ​inside the Sub Quote_Click( ) routine: ​
  
 <code vbnet> <code vbnet>
-Private Sub GetQuote_Click() +Private Sub Quote_Click() 
 Call GetQuote ​ Call GetQuote ​
 End Sub  End Sub 
 </​code>​ </​code>​
  
-12In the code sheet, create a subroutine to update the entry box when new data arrives from the RTW COM Interface. ​+13Create a subroutine called GetQuote which gets the quote for the record that is entered.  
 + 
 +<code vbnet> 
 +Private Sub GetQuote()  
 +'​Declared Variables  
 + 
 + Dim info() As Variant  
 + Dim new_vals As Boolean  
 + Dim result As Variant  
 + Dim RIC_STR As String  
 + 
 + '​Getting the Quote for the record entered.  
 + '​ If no record was entered, then display error message  
 + '​Else  
 + '​ Get QUOTE from the appropriate Engine.  
 + 
 + ​DSPLY_NAME.Text = ""​  
 + ​BIDVALUE.Text = ""​  
 + ​ASKVALUE.Text = ""​  
 + ​TRDPRC_1.Text = ""​  
 + 
 + If RIC.Text = ""​ Then  
 + ​MsgBox "No record was entered"​  
 + ​RIC.SetFocus  
 + Else  
 + ​RIC_STR = UCase(RIC.Text)  
 + 
 + ​Select Case LCase(engine.Text)  
 + Case "​mktdemo"​  
 +    info = Array("​rt",​ "​mktdemo","​IDN_SELECTFEED",​ RIC_STR, "​DSPLY_NAME",​ "​BID",​ "​ASK",​ "​TRDPRC_1"​)  
 + 
 + Case "rmds ssl"  
 +    info = Array("​rt",​ "​vsrmds",​ "​IDN_SELECTFEED",​ RIC_STR, "​DSPLY_NAME",​ "​BID",​ "​ASK",​ "​TRDPRC_1"​)  
 + 
 + Case "​webdata via yahoo"  
 +    info = Array("​rt",​ "​rthttp",​ "​Yahoo",​ RIC_STR, "​NAME",​ "​BID",​ "​ASK",​ "​LAST"​)  
 + 
 + Case "​bloomberg"​  
 +    Index = InStr(1, RIC_STR, "​EQUITY"​)  
 +    If Index = 0 Then  
 +       ​RIC_STR = RIC_STR & " Equity"​  
 +    Else  
 +       ​RIC_STR = Replace(RIC_STR,​ "​EQUITY",​ "​Equity"​)  
 +    End If  
 +    info = Array("​rt",​ "​axbloom",​ "​TICKERX",​ RIC_STR, "​Name",​ "Bid Price",​ "Ask Price",​ "Last Trade"​)  
 +    RIC.Text = ""​  
 + End Select  
 + 
 + ​RIC.Text = RIC_STR  
 + ​new_vals = True  
 + 
 + '​Check to see if the same engine is being used. If  
 + '​so,​ do not restart engine.  
 + 
 + If MyEngine = LCase(engine.Text) Then  
 +    Topic_Id = Topic_Id + 1  
 +    Call vsrt.VSRTConnectData(Topic_Id,​ info, new_vals, result)  
 +    Call vsrt.VSRTDisconnectData(Topic_Id - 1)  
 +    '​disconnect the old record  
 + Else  
 +    Call vsrt.VSRTDisconnectData(Topic_Id) '​disconnect the old record  
 +    Topic_Id = 1  
 +    Call vsrt.VSRTConnectData(Topic_Id,​ info, new_vals, result)  
 +    MyEngine = LCase(engine.Text)  
 + End If  
 + End If  
 +End Sub  
 +</​code>​ 
 + 
 + 
 +14. Next, create a subroutine to update the entry box when new data arrives from the RTW COM Interface. ​
  
 <code vbnet> <code vbnet>
 Private Sub vsrt_VSUpdateNotify() ​ Private Sub vsrt_VSUpdateNotify() ​
-Dim TOPIC_COUNTAs ​Long +Dim TOPIC_COUNT As Long 
 Dim data() As Variant ​ Dim data() As Variant ​
  
Line 434: Line 502:
 </​code>​ </​code>​
  
-13. The final code sheet should look similar to this: + 
 +15. The final code sheet should look similar to this: 
  
 <code vbnet> <code vbnet>
Line 493: Line 562:
  '​Getting the Quote for the record entered. ​  '​Getting the Quote for the record entered. ​
  '​ If no record was entered, then display error message ​  '​ If no record was entered, then display error message ​
- ​Else ​+ 'Else 
  '​ Get QUOTE from the appropriate Engine. ​  '​ Get QUOTE from the appropriate Engine. ​
  
Line 524: Line 593:
        ​RIC_STR = Replace(RIC_STR,​ "​EQUITY",​ "​Equity"​) ​        ​RIC_STR = Replace(RIC_STR,​ "​EQUITY",​ "​Equity"​) ​
     End If      End If 
-    info = Array("​rt",​ "​axbloom",​ "​TICKERX", ​ +    info = Array("​rt",​ "​axbloom",​ "​TICKERX",​ RIC_STR, "​Name",​ "Bid Price",​ "Ask Price",​ "Last Trade"​) ​
-    ​RIC_STR, "​Name",​ "Bid Price",​ "Ask Price",​ "Last Trade"​) ​+
     RIC.Text = "" ​     RIC.Text = "" ​
  End Select ​  End Select ​
Line 533: Line 601:
  
  '​Check to see if the same engine is being used. If   '​Check to see if the same engine is being used. If 
- so, do not restart engine. ​+ 'so, do not restart engine. ​
  
  If MyEngine = LCase(engine.Text) Then   If MyEngine = LCase(engine.Text) Then 
     Topic_Id = Topic_Id + 1      Topic_Id = Topic_Id + 1 
-    Call vsrt.VSRTConnectData(Topic_Id,​ info,  +    Call vsrt.VSRTConnectData(Topic_Id,​ info, new_vals, result) ​
-    ​new_vals, result) ​+
     Call vsrt.VSRTDisconnectData(Topic_Id - 1)      Call vsrt.VSRTDisconnectData(Topic_Id - 1) 
     '​disconnect the old record ​     '​disconnect the old record ​
Line 544: Line 611:
     Call vsrt.VSRTDisconnectData(Topic_Id) '​disconnect the old record ​     Call vsrt.VSRTDisconnectData(Topic_Id) '​disconnect the old record ​
     Topic_Id = 1      Topic_Id = 1 
-    Call vsrt.VSRTConnectData(Topic_Id,​ info,  +    Call vsrt.VSRTConnectData(Topic_Id,​ info, new_vals, result) ​
-    ​new_vals, result) ​+
     MyEngine = LCase(engine.Text) ​     MyEngine = LCase(engine.Text) ​
  End If   End If 
Line 582: Line 648:
 </​code>​ </​code>​
  
-14. Save the Visual Basic Application by selecting File -> Save Project. The first dialog box is the Save Form dialog box. Name the form as VistaSource_QuickQuote_Form. Note the file has the .frm extension ​+16. Save the Visual Basic Application by selecting ​**File -> Save Project**. The first dialog box is the Save Form dialog box. Name the form as VistaSource_QuickQuote_Form. Note the file has the .frm extension ​
  
 A second dialog box Save Project is displayed. Name the project as VistaSource_QuickQuote. This will have the .vbp extension. ​ A second dialog box Save Project is displayed. Name the project as VistaSource_QuickQuote. This will have the .vbp extension. ​
  
-15. Optionally, you can make an executable file, by selecting File -> Make VistaSource_QuickQuote.exe ​+17. Optionally, you can make an executable file, by selecting ​**File -> Make VistaSource_QuickQuote.exe**.
  
-16. To run the program, either from the menu by selecting Run -> Start or pressing F5 key or the icon. +18. To run the program, either from the menu by selecting ​**Run -> Start** or pressing F5 key or the icon. 
  
  
-===== Publishing with the RTW COM Interface ===== +===== Publishing with the RTW COM Interface ​(Sample) ​===== 
- ​(Sample) ​ + 
  The following sample code illustrates how to create a simple form with two   The following sample code illustrates how to create a simple form with two 
  text boxes for publishing with the RTW COM Interface. In the first text box,   text boxes for publishing with the RTW COM Interface. In the first text box, 
  enter the value you would like to publish. The second text box displays the   enter the value you would like to publish. The second text box displays the 
  ​confirmation "​OK",​ if the publishing was successful or the error message ​  ​confirmation "​OK",​ if the publishing was successful or the error message ​
- "​NA",​ if it failed. ​+ "​NA",​ if it failed. This sample was created using VB 6.0.
  
 ==== How to Create a Sample Publish Project ====  ==== How to Create a Sample Publish Project ==== 
  
-1. Start a new Standard EXE project in Visual Basic. Form1 is created by default. ​+1. Start a new Standard EXE project in Visual Basic. Form1 is created by default. ​ 
  
-2. Add 2 TextBoxes and CommandButton ​to Form1. The Text1 object represents the publishing valueText2 displays the result after the CommandButtonis pressedText2 will display OK if publishing succeeded or NA if it failed+2. Before you begin to programyou must reference ​the Vistasource RTD Server library (VSRtdServer 1.0 Type Library)
  
- 3. Copy the following code to the Code window of Form1: ​+a. From the menu bar, select **Project ->​References**. \\  
 +b. Scroll down the list and check the box that has VSRtdServer 1.0 Type Library. 
 + 
 +3. Add 2 TextBoxes and CommandButton to Form1. The Text1 object represents the publishing value, Text2 displays the result after the CommandButton is pressed. Text2 will display OK if publishing succeeded or NA if it failed.  
 + 
 +4. Copy the following code to the Code window of Form1: ​
  
 <code vbnet> <code vbnet>
Line 621: Line 691:
  '​The Engine is vsrmds2 - RMDS RFA engine ​  '​The Engine is vsrmds2 - RMDS RFA engine ​
  '​The Service is DTS   '​The Service is DTS 
- '​The Record is MEWTEST ​+ '​The Record is TestRic
  '​The Field is ASK   '​The Field is ASK 
  
Line 657: Line 727:
  
 </​code>​ </​code>​
-- 
  
-===== Creating a C++ Client for the RTW COM Interface ===== + 
-(Sample) ​+===== Creating a C++ Client for the RTW COM Interface ​(Sample) ​=====
  
 This sample illustrates how to build a C++ client application (using MFC) that connects to the Pre-Recorded Playback "​mktdemo"​ engine for retrieving the trade price (TRDPRC_1) of a particular record. The incoming data is displayed in an entry field in a dialog box. This sample was created using Microsoft Visual C++ 6.0.  This sample illustrates how to build a C++ client application (using MFC) that connects to the Pre-Recorded Playback "​mktdemo"​ engine for retrieving the trade price (TRDPRC_1) of a particular record. The incoming data is displayed in an entry field in a dialog box. This sample was created using Microsoft Visual C++ 6.0. 
Line 671: Line 740:
 </​note>​ </​note>​
  
-== How to build a C++ Application that uses the RTW COM Interface ==+=== How to build a C++ Application that uses the RTW COM Interface ​===
  
-The easiest way to build a C++ application that uses the RTW COM Interface is to use the MFC AppWizard. There are three main steps to consider when building a MFC client. ​+The easiest way to build a C++ application that uses the RTW COM Interface is to use the MFC AppWizard. There are four main steps to consider when building a MFC client. ​
  
 +  * Create a project (Advanced users may want to skip to Step 2).
   * Create a dialog box.    * Create a dialog box. 
   * Write the code that drives the dialog box.    * Write the code that drives the dialog box. 
   * Create a sink object that will receive update notifications from the COM server. ​   * Create a sink object that will receive update notifications from the COM server. ​
  
-**Step 1: Create a Dialog Box**  
  
-Open Visual C++ and create ​new MFC AppWizard (exe) project by choosing File -> New and then selecting “MFC App Wizard (exe)” in the Projects tab. +== Step 1: Create ​Project ==
  
-For this sample, the project will be named VSClient. In the MFC App Wizard make sure+To create a MFC AppWizard (exe) project in C++:
  
-1. The MFC project is a Dialog Based application (Step 1).  +1. Open Visual C++
-2. The project supports Automation and ActiveX Controls (Step 2)+
  
-After clicking the Finish button, the App Wizard will create a skeleton project and display a starter dialog boxIn the dialog box you need to do the following: ​+2. Choose **File ->New**.
  
-3. Create two Edit Box controls and one Button control+3. Select **MFC App Wizard (exe)** in the Projects tab.
  
-4. Change one Edit Box control ID to IDC_DATA and give it read-only style (right-click the control and choose Properties). This is the entry field that will receive ​the incoming data+4. Type project name. This sample uses the name VSClient.
  
-5. Change the other Edit Box control ID to IDC_RECORD. This is the entry field in which the record name will be typed+5. Click **OK**
  
-6. Change the Button control ID to IDC_CONNECT and change the Caption to "​Connect"​. ​You need to make this button a default button. This is the button that will initiate ​the connection to the COM serverand make the request. ​+The dialog box MFC AppWizard - Step 1 is displayed, asking what type of application would you like to create? 
 +  
 +6. Select **Dialog based** and click **Next**. 
 + 
 +The dialog box MFC AppWizard - Step 2 is displayed, asking what other support would you like to include? 
 + 
 +7. Make sure both **Automation** and **ActiveX Controls** are selected. 
 +  
 +8. Click **Finish**.  
 + 
 + 
 +After clicking the **Finish** button, the App Wizard will create a skeleton project and display a starter dialog box 
 + 
 + 
 +== Step 2: Create a Dialog Box == 
 + 
 +<​note>​If you skipped Step 1, make sure the project name is VSClient, the MFC project is a Dialog Based application and supports Automation and ActiveX Controls. </​note>​ 
 + 
 +In the dialog box, you need to do the following:  
 + 
 +1. Create two Edit Box controls and one Button control.  
 + 
 +2. Change one Edit Box control ID to IDC_DATA and give it a read-only style. This is the entry field that will receive the incoming data. To do so, right-click on the Edit Control and select Properties. In the Properties dialog box, select the General tab and change ID to IDC_DATA. On the Styles tab, select Read-Only. Close the dialog box.  
 + 
 +3. Similarly, change the other Edit Box control ID to IDC_RECORD. This is the entry field in which the record name will be typed.  
 + 
 +4. Change the Button control ID to IDC_CONNECT and change the Caption to "​Connect"​. ​This button ​needs to be a default button ​which initiates ​the connection to the COM server and makes the request. To do so, select the General tab in the Properties dialog box and change ID to IDC_CONNECT and the Caption to "​Connect"​. On the Styles tab, select "​Default Button"​. Close the dialog box
  
-7. Create a function for the Connect button by double-clicking on it. The member function name should be OnConnect. Press OK. Information on how to create the function will follow later in this document. ​+5. Create a function for the Connect button by double-clicking on it. The member function name should be OnConnect. Press **OK**. Information on how to create the function will follow later in this document. ​
  
-8. Delete the OK button. ​+6. Delete the OK button. ​
  
 The dialog box is now complete and the code behind it can now be written. ​ The dialog box is now complete and the code behind it can now be written. ​
  
-Step 2: The Code behind the dialog box +== Step 3: The Code behind the dialog box ==
  
 Writing the code behind the dialog box consists of two phases: ​ Writing the code behind the dialog box consists of two phases: ​
Line 711: Line 805:
   * Fill out the member functions. ​   * Fill out the member functions. ​
  
-Create header files and global variables ​+**Create header files and global variables**
  
 To create the header files and global variables: ​ To create the header files and global variables: ​
  
-1. Open the source file VSClientDlg.cpp. ​+1. Open the source file VSClientDlg.cpp ​via the FileView button on the left
  
 2. Add the following global variables: ​ 2. Add the following global variables: ​
Line 741: Line 835:
   * pEditData is a pointer to the IDC_DATA Edit Box for incoming data placement. ​   * pEditData is a pointer to the IDC_DATA Edit Box for incoming data placement. ​
  
-3. In addition, the following files need to be included: ATLBASE.H, afxctl.h, VSSink.h, and VSRtdServer_i.c (the latter file contains the COM object declarations: ​+3. In addition, the following files need to be included: ATLBASE.H, afxctl.h, VSSink.h, and VSRtdServer_i.c (the latter file contains the COM object declarations)
  
 The top of the VSClientDlg.cpp source file should look like this:  The top of the VSClientDlg.cpp source file should look like this: 
Line 750: Line 844:
 #include "​VSClient.h" ​ #include "​VSClient.h" ​
 #include "​VSClientDlg.h" ​ #include "​VSClientDlg.h" ​
-#​include ​VSSink.h” +#​include ​"VSSink.h" ​
 #include "​DlgProxy.h" ​ #include "​DlgProxy.h" ​
 #include "​VSRtdServer_i.c" ​ #include "​VSRtdServer_i.c" ​
Line 770: Line 864:
 </​code>​ </​code>​
  
-Fill out the member functions ​+**Fill out the member functions**
  
 To fill out the member functions, complete the following steps: ​ To fill out the member functions, complete the following steps: ​
  
-1. Assign the pEditData pointer to the IDC_DATA edit box. This is  necessary to be able to insert values into the entry field. ​ +1. Assign the pEditData pointer to the IDC_DATA edit box. This is  necessary to be able to insert values into the entry field. ​ In the function CVSClientDlg::​OnInitDialog() insert the following ​statement ​below the line "TODO: Add extra initialization here"
- +
-2. In the function CVSClientDlg::​OnInitDialog() insert the statement: ​+
  
-FIXME TODO: Add extra initialization here: 
 <code cpp> ​ <code cpp> ​
  ​pEditData = (CEdit*)GetDlgItem(IDC_DATA); ​  ​pEditData = (CEdit*)GetDlgItem(IDC_DATA); ​
 </​code>​ </​code>​
  
-3. Fill out the OnConnect function that was assigned to the Connect button. The connection to the RTW COM Interface and the request for data happen here. In the function CVSClientDlg::​OnConnect(),​ add the following code: +2. Fill out the OnConnect function that was assigned to the Connect button. The connection to the RTW COM Interface and the request for data happen here. In the function CVSClientDlg::​OnConnect(),​ add the following code: 
  
 <code cpp> <code cpp>
Line 790: Line 881:
  
  ​CEdit* pEditRecord = (CEdit*)GetDlgItem(IDC_RECORD); ​  ​CEdit* pEditRecord = (CEdit*)GetDlgItem(IDC_RECORD); ​
- ​CString strRecord; //Declare a variable to hold the entered ​ + ​CString strRecord; //Declare a variable to hold the entered text; 
- text; +
  ​pEditRecord->​GetWindowText(strRecord); ​  ​pEditRecord->​GetWindowText(strRecord); ​
  
Line 907: Line 997:
 </​code>​ </​code>​
  
-4. Now you can write the function that will retrieve the data and display it in the dialog box. +3. Now you can write the function that will retrieve the data and display it in the dialog box. 
  
-When the RTW COM Interface receives data, it will trigger an event, which will be captured by the sink object we write in Step (see below). The sink object will then have to call into the dialog box for the data to be retrieved and displayed. ​+When the RTW COM Interface receives data, it will trigger an event, which will be captured by the sink object we write in Step (see below). The sink object will then have to call into the dialog box for the data to be retrieved and displayed. ​
  
- a. Using the Class View tab, right-click on the CVSClientDlg interface and select Add Member Function. ​+ a. Using the Class View tab, right-click on the **CVSClientDlg** interface and select ​**Add Member Function**
  
  b. The Function Type: void   b. The Function Type: void 
Line 919: Line 1009:
  d. Access: Public  d. Access: Public
    
- e. Press OK. + e. Press **OK**
  
  f. Now you should be in the UpdateEvent function. Add the following code to the UpdateEvent function: ​  f. Now you should be in the UpdateEvent function. Add the following code to the UpdateEvent function: ​
Line 928: Line 1018:
  ​SAFEARRAY * psa;   ​SAFEARRAY * psa; 
  long TopicCount; ​  long TopicCount; ​
- long aiIndex[2]; //Declare array equal to the number of  + long aiIndex[2]; //Declare array equal to the number of bounds ​
- bounds ​+
  long idx = -1;   long idx = -1; 
  ​CString str;   ​CString str; 
Line 937: Line 1026:
  
  ​HRESULT hr = m_pSrc->​VSRTRefreshData(&​TopicCount,&​psa); ​  ​HRESULT hr = m_pSrc->​VSRTRefreshData(&​TopicCount,&​psa); ​
- If(SUCCEEDED(hr)) ​+ if(SUCCEEDED(hr)) ​
  ​{ ​  ​{ ​
  
Line 961: Line 1050:
  ​CLEARVARIANT: ​  ​CLEARVARIANT: ​
  
-VariantClear(&​variant) ​+VariantClear(&​variant)
  ​} ​  ​} ​
 </​code>​ </​code>​
  
-5After the dialog box is destroyed, a proper disconnect from the RTW COM Interface is required. To do so: +4Next, we will write a disconnect function, which will run when the dialog box is destroyed. A proper disconnect from the RTW COM Interface is required. To do so: 
  
  a. Using the ClassView tab, right-click on the CVSClientDlg interface and select Add Member Function. ​  a. Using the ClassView tab, right-click on the CVSClientDlg interface and select Add Member Function. ​
Line 971: Line 1060:
  b. The Function Type: void   b. The Function Type: void 
  
- c. The Function Name:​DisconnectData ​+ c. The Function Name: DisconnectData ​
  
  d. Access: Public ​  d. Access: Public ​
  
- e. Press OK. + e. Press **OK**
  
  f. In DisconnectData function, add the following code:   f. In DisconnectData function, add the following code: 
Line 999: Line 1088:
 </​code>​ </​code>​
  
-Finally, add a message handler to disconnect the data when the dialog box is destroyed: ​+5. Finally, add a message handler to disconnect the data when the dialog box is destroyed: ​
  
-1. Using the ClassView tab, right-click on the CVSClientDlg interface and select Adds Windows Message Handler. ​+a. Using the ClassView tab, right-click on the** CVSClientDlg** interface and select ​**Adds Windows Message Handler**
  
-2. In the New Windows ​messages/​events ​window, select WM_DESTROY and click on Add Haddler. Then click OK. You should now see OnDestroy in the Class View tab. +b. In the New Windows ​Message and Event Handlers for class CVSClientDlg ​window, select ​**WM_DESTROY** and click on **Add Handler**. Then click **OK**. You should now see OnDestroy in the Class View tab. 
  
-3. Using the Class View tab, double-click on the OnDestroy function. This should bring you to the code. +c. Using the Class View tab, double-click on the** OnDestroy** function. This should bring you to the code. 
  
-4. Add the DisconnectData();​ statement to the CVSClientDlg::​OnDestroy () function. Now the OnDestroy() function should looks like: +d. Add the DisconnectData();​ statement to the CVSClientDlg::​OnDestroy () function. Now the OnDestroy() function should looks like: 
  
 <code cpp> <code cpp>
- ​void ​CMFCClientDlg::​OnDestroy() ​+ ​void ​CVSClientDlg::​OnDestroy() ​
  ​{ ​  ​{ ​
  ​CDialog::​OnDestroy(); ​  ​CDialog::​OnDestroy(); ​
Line 1017: Line 1106:
 </​code>​ </​code>​
  
-Step 3: Create a sink object to connect to the VSRtdServer update events+== Step 4: Create a sink object to connect to the VSRtdServer update events ​==
  
 To create a sink object that will receive update notifications from the RTW COM Interface, complete the following steps: ​ To create a sink object that will receive update notifications from the RTW COM Interface, complete the following steps: ​
  
- 1. Use the ClassWizard (Ctrl+W) to create a new class. ​+ 1. Use the ClassWizard (Ctrl+W) to create a new class by selecting **Add Class ->New** in this dialog
  
  2. Give it a name (i.e. VSSink). ​  2. Give it a name (i.e. VSSink). ​
  
- 3. For the Base Class, use the drop-down list to select the CCmdTarget. ​+ 3. For the Base Class, use the drop-down list to select the **CCmdTarget**
  
- 4. Select the Automation radio button. ​+ 4. Select the **Automation** radio button ​and the click **OK** in this dialog
  
- 5. Import the VSRtdServer.dll in the StdAfx.h file, as below. (If VSRtdServer.dll is not part of the project, the full path must be specified.) ​+ 5. Import the VSRtdServer.dll in the StdAfx.h file, as below. (If VSRtdServer.dll is not part of the project, the full path must be specified.) ​To access StdAfx.h, click on the **File View** tab and open  
 +StdAfx.h.
  
 <code cpp> <code cpp>
Line 1035: Line 1125:
  // Microsoft Visual C++ will insert additional declarations immediately ​  // Microsoft Visual C++ will insert additional declarations immediately ​
  ​before #the previous line.   ​before #the previous line. 
- #​import "​VSRtdServer.dll"​ rename_namespace("​VSClient"​) using namespace ​ + #​import "​VSRtdServer.dll"​ rename_namespace("​VSClient"​) 
- #VSClient; ​+ using namespace VSClient; ​
  #​endif // !defined(AFX_STDAFX_H__EA983678_D844_4452_ ​  #​endif // !defined(AFX_STDAFX_H__EA983678_D844_4452_ ​
  ​A409_E9370926109E__INCLUDED_) ​  ​A409_E9370926109E__INCLUDED_) ​
Line 1058: Line 1148:
  
 <code cpp> <code cpp>
- #​include ​VSClientDlg.h”  + #​include ​"VSClientDlg.h" ​ 
- #​include ​VSRtdServer_i.c” + #​include ​"VSRtdServer_i.c" ​
  /* don’t forget the directory path (directory path can be a relative path) if this file is not in the same directory as your project. */   /* don’t forget the directory path (directory path can be a relative path) if this file is not in the same directory as your project. */ 
 </​code>​ </​code>​
  
- 9. Modify the INTERFACE_PART macro so that the second parameter (IID) is the DIID (DispInterfaceID) ​\\  + 9. Modify the INTERFACE_PART macro so that the second parameter (IID) is the DIID (DispInterfaceID) 
-of the event source, in our case IID_ _IVSControlEvents,​ the interface map should looks like: +of the event source, in our case DIID_ _IVSControlEvents,​ the interface map should looks like: 
  
 <code cpp> <code cpp>
Line 1073: Line 1163:
 </​code>​ </​code>​
  
- 10. Using the ClassView tab, right-click on the IVSSink interface and select Add Method. Use the following parameters for the added method. ​+ 10. Using the ClassView tab, right-click on the **IVSSink** interface and select ​**Add Method**. Use the following parameters for the added method. ​
  
   * External Name:​**VSUpdateEvent.** ​   * External Name:​**VSUpdateEvent.** ​
Line 1079: Line 1169:
   * Return Type: **void.** ​   * Return Type: **void.** ​
    
- 11. Press OK. + 11. Press **OK**
  
  Now in the VSSink.cpp source file, the DISPATCH_MAP code looks like:   Now in the VSSink.cpp source file, the DISPATCH_MAP code looks like: 
Line 1100: Line 1190:
  // TODO: Add your dispatch handler code here   // TODO: Add your dispatch handler code here 
  ​CVSClientDlg client; ​  ​CVSClientDlg client; ​
- ​client.UpdateEvents(); //Calling the CVSClientDlg::​UpdateEvents ​+ ​client.UpdateEvent(); //Calling the CVSClientDlg::​UpdateEvents ​
  ​} ​  ​} ​
  
Line 1111: Line 1201:
    
  
-This appendix provides some supplementary commands that greatly help the COM client developer. They can be used by replacing the Command argument of the COM Server’s ConnectData method (see [[#​Introducing the RTW COM Interface]] ), which is normally "​rt"​” or "​rtinsert"​”, ​ with other command strings that are detailed below. These command strings ​ are also valid for the RTD function itself. ​+This appendix provides some supplementary commands that greatly help the COM client developer. They can be used by replacing the Command argument of the COM Server’s ConnectData method (see [[#​Introducing the RTW COM Interface]]),​ which is normally "​rt"​” or "​rtinsert"​”, ​ with other command strings that are detailed below. These command strings ​ are also valid for the RTD function itself. ​
  
 For example, to obtain the services the mktdemo engine is using in the VB demo code above, the info() string would be set like this:  For example, to obtain the services the mktdemo engine is using in the VB demo code above, the info() string would be set like this: 
Line 1259: Line 1349:
 |Arguments |field_id| ​ |Arguments |field_id| ​
  
-<note vb>This command takes an id string that must be obtained from a call to GF, \\ which returns a list of field names with their values and an id. It is not a data service fid, but an internal id used to keep track of usage. </​note>​+<note vb>This command takes an id string that must be obtained from a call to GF, which returns a list of field names with their values and an id. It is not a data service fid, but an internal id used to keep track of usage. </​note>​
  
 == Example ==  == Example ==