看tws-user-guide.pdf 在IB有下载的 Application Program Interface ActiveX Link to the application using ActiveX Before you can use third-party ActiveX controls, you must register them with Visual Basic. To link using the ActiveX control and VB, VBA or C++ 1. Drop the application control onto a form or dialog box. 2. Call the following methods: • Call the connect() method to connect to the running aplication. • Call the methods you need to perform whatever operations you require, such as the reqMktData() method to request market data. 3. Call the placeOrder() method to place an order. Orders using extended attributes require that ActiveX properties representing them be set first. 4. Handle the following events: • Handle the nextValidId() event to receive the next available valid order ID. Increment the ID by one for successive orders. • Handle the tickPrice() and tickSize() events to receive the market data. • Handle the orderStatus() event to receive status information about orders. • Handle the error() event to receive error information. • Handle the connectionClosed() event to be notified in case the application stops communicating with the ActiveX control. 这个文档里面也有事件、方法、变量的详细介绍