我是 Visual Basic 的新手,我正在处理的程序有问题。我正在使用 Sterling ActiveX 库创建一个基本的功能程序,该程序为 Sterling Trader 软件执行一项简单的任务(发送订单)。我只是想制作一些基本的东西,我可以从中建立起来。到目前为止,这是我的代码:
Imports SterlingLib
Public Class Form1
Dim WithEvents m_STIEvents As STIEvents
Private Declare Sub GetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME)
Private Structure SYSTEMTIME
Dim wYear As Short
Dim wMonth As Short
Dim wDayOfWeek As Short
Dim wDay As Short
Dim wHour As Short
Dim wMinute As Short
Dim wSecond As Short
Dim wMilliseconds As Short
End Structure
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
m_STIEvents = New STIEvents
End Sub
Private Sub m_STIEvents_OnSTIOrderUpdateMsg(ByVal oSTIOrderUpdateMsg As SterlingLib.STIOrderUpdateMsg) Handles m_STIEvents.OnSTIOrderUpdateMsg
Dim order As STIOrder
order = New STIOrder
Dim storder As structSTIOrder
storder.bstrAccount = "ACCT7"
storder.bstrSide = "B"
storder.bstrSymbol = "CSCO"
order.Quantity = "500"
storder.bstrStrPriceType = SterlingLib.STIPriceTypes.ptSTIMkt
storder.bstrTif = "D"
storder.bstrDestination = "NYSE"
Dim theTime As SYSTEMTIME
GetLocalTime(theTime)
storder.bstrClOrderId = storder.bstrAccount & theTime.wYear & theTime.wMonth & theTime.wDay & theTime.wHour & theTime.wMinute & theTime.wSecond & theTime.wMilliseconds
Dim ret As Integer
ret = order.SubmitOrder
End Sub
Private Function Text1() As Object
Throw New NotImplementedException
End Function
End Class
当我运行这个程序时,我收到以下错误:“您的应用程序中发生了未处理的异常。如果单击继续,应用程序将忽略此错误并尝试继续。如果单击退出,应用程序将立即关闭。
由于以下错误,检索具有 CLSID {5E89F49B-6A12-420F-8570-E510EF1B580A} 的组件的 COM 类工厂失败:800700c1。”
这是什么意思,我该如何纠正?当我调试时,它突出显示“m_STIEvents = New STIEvents”作为出现问题的行,但我无法弄清楚。