📄 form1.frm
字号:
VERSION 5.00
Object = "{4F6A9E80-C79C-11D2-B401-00C04FCCA334}#1.0#0"; "STOCK.DLL"
Begin VB.Form 通视VB接口示范程序
Caption = "Form1"
ClientHeight = 8820
ClientLeft = 60
ClientTop = 345
ClientWidth = 9135
LinkTopic = "Form1"
ScaleHeight = 8820
ScaleWidth = 9135
StartUpPosition = 3 'Windows Default
Begin VB.TextBox m_BaseOut
Height = 975
Left = 1560
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 13
Text = "Form1.frx":0000
Top = 7200
Width = 6975
End
Begin VB.TextBox m_NewsOut
Height = 375
Left = 1200
TabIndex = 11
Text = "Text1"
Top = 6600
Width = 7335
End
Begin VB.CommandButton m_setup
Caption = "设置"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3720
TabIndex = 9
Top = 2040
Width = 1335
End
Begin VB.TextBox m_HisOut
Height = 885
Left = 1200
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 8
Text = "Form1.frx":0006
Top = 5640
Width = 7335
End
Begin VB.TextBox m_Min
Height = 855
Left = 1200
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 6
Text = "Form1.frx":000C
Top = 4680
Width = 7335
End
Begin VB.TextBox m_Out
Height = 1455
Left = 1200
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Text = "Form1.frx":0012
Top = 3120
Width = 7335
End
Begin VB.CommandButton m_end
Caption = "停止接收"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5880
TabIndex = 2
Top = 2040
Width = 1455
End
Begin VB.CommandButton m_start
Caption = "开始接收"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 1
Top = 2040
Width = 1335
End
Begin STOCKLibCtl.StockDriver m_stkdrv
Height = 1575
Left = 240
OleObjectBlob = "Form1.frx":0018
TabIndex = 0
Top = 120
Width = 8655
End
Begin VB.Label Label4
Caption = "基本资料"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 12
Top = 7320
Width = 975
End
Begin VB.Label Label3
Caption = "消息"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 10
Top = 6600
Width = 495
End
Begin VB.Line Line4
X1 = 8760
X2 = 8760
Y1 = 2880
Y2 = 8280
End
Begin VB.Line Line3
X1 = 360
X2 = 8760
Y1 = 8280
Y2 = 8280
End
Begin VB.Line Line2
X1 = 360
X2 = 360
Y1 = 2880
Y2 = 8280
End
Begin VB.Line Line1
X1 = 360
X2 = 8760
Y1 = 2880
Y2 = 2880
End
Begin VB.Label LineTxt
Caption = "日线"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 7
Top = 5880
Width = 615
End
Begin VB.Label Label2
Caption = "分时"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 5
Top = 4920
Width = 495
End
Begin VB.Label Label1
Caption = "行情"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 4
Top = 3840
Width = 495
End
End
Attribute VB_Name = "通视VB接口示范程序"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim OneHis As New StockHisData
Dim OneMin As New StockMinData
Dim OneStk As New StockReport
Private Sub Form_Load()
a = "通视信息卡,ID号=" + m_stkdrv.RcvIDCode
a = a + vbCrLf + "驱动程序版本 = " + m_stkdrv.Version
m_Out = a
End Sub
Private Sub Form_Unload(Cancel As Integer)
m_stkdrv.Stop
End Sub
Private Sub m_end_Click()
m_stkdrv.Stop
End Sub
Private Sub m_setup_Click()
m_stkdrv.Setup (1)
End Sub
Private Sub m_start_Click()
m_stkdrv.Receive
End Sub
Private Sub m_stkdrv_OnBaseFile(ByVal strFileName As String, ByVal Market As Integer, ByVal nFileLen As Long, ByVal pBuf As Long)
Dim DstTxt As String
DstText = strFileName
DstText = DstText + " "
DstText = DstText & nFileLen
DstText = DstText + " "
txt = m_stkdrv.ToString(nFileLen, pBuf)
DstText = DstText + Left(txt, 50)
m_BaseOut.Text = DstText
End Sub
Private Sub m_stkdrv_OnHistory(ByVal nPacketNum As Long, ByVal pBuf As Long)
Call OneHis.Attach(nPacketNum, pBuf)
Dim DstTxt As String
nPacketNum = OneHis.PacketNum
DstTxt = "收到" & nPacketNum & "个数据包" + vbCrLf
Dim Buf As OLE_RCV_HISTORY
Dim OldLabel As String
For i = 0 To nPacketNum - 1
Buf = OneHis.ElementAt(i)
If (StrComp(Buf.m_strLabel, OldLabel) <> 0) Then
OldLabel = Buf.m_strLabel
DstTxt = DstTxt & OneHis.strLabel
DstTxt = DstTxt + " "
DstTxt = DstTxt & OneHis.OpenPrice
DstTxt = DstTxt + " "
DstTxt = DstTxt & OneHis.Volume
DstTxt = DstTxt + " "
DstTxt = DstTxt & OneHis.Time
DstTxt = DstTxt + vbCrLf
End If
Next
m_HisOut.Text = DstTxt
End Sub
Private Sub m_stkdrv_OnMinData(ByVal nPacket As Long, ByVal pBuf As Long)
Call OneMin.Attach(nPacket, pBuf)
nPackNum = OneMin.PacketNum
Dim DstTxt As String
Dim Buf As OLE_RCV_MINUTE
Dim OldLabel As String
DstTxt = "收到" & nPackNum & "个分时数据" + vbCrLf
For i = 0 To nPackNum - 1
Buf = OneMin.ElementAt(i)
If (StrComp(Buf.m_strLabel, OldLabel) <> 0) Then
OldLabel = Buf.m_strLabel
DstTxt = DstTxt & Buf.m_strLabel
DstTxt = DstTxt + " "
DstTxt = DstTxt & Buf.m_fPrice
DstTxt = DstTxt + " "
DstTxt = DstTxt & Buf.m_fVolume
DstTxt = DstTxt + " "
DstTxt = DstTxt & Buf.m_Time
DstTxt = DstTxt + vbCrLf
End If
Next i
m_Min.Text = DstTxt
End Sub
Private Sub m_stkdrv_OnNewsFile(ByVal NewsType As Long, ByVal SerialNo As Long, ByVal pFileName As String, ByVal nFileLen As Long, ByVal pBuf As Long)
Dim DstText As String
If NewsType = 2 Then
DstText = "上交所公告"
End If
If NewsType = 4 Then
DstText = "深交所公告"
End If
If NewsType = 6 Then
DstText = "财经报道"
End If
DstText = DstText + "<"
DstText = DstText & SerialNo
DstText = DstText + "> "
txt = m_stkdrv.ToString(nFileLen, pBuf)
DstText = DstText + Left(txt, 50)
m_NewsOut.Text = DstText
End Sub
Private Sub m_stkdrv_OnReport(ByVal nPacket As Long, ByVal pBuf As Long)
Call OneStk.Attach(nPacket, pBuf)
Dim DstTxt As String
Dim Buf As OLE_RCV_REPORT
For i = 0 To nPacket - 1
Buf = OneStk.ElementAt(i)
DstTxt = DstTxt & Buf.m_Time
DstTxt = DstTxt + " "
DstTxt = DstTxt + Buf.m_strLabel
DstTxt = DstTxt + " "
DstTxt = DstTxt + Buf.m_strName
DstTxt = DstTxt + " "
DstTxt = DstTxt & Buf.m_fNewPrice
DstTxt = DstTxt + " "
DstTxt = DstTxt & Buf.m_fAmount
DstTxt = DstTxt + " "
DstTxt = DstTxt & Buf.m_fVolume
DstTxt = DstTxt + " "
DstTxt = DstTxt & Buf.m_fBuyPrice(0)
DstTxt = DstTxt + " "
DstTxt = DstTxt & Buf.m_fBuyVolume(0)
DstTxt = DstTxt + vbCrLf
Next i
m_Out.Text = DstTxt
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -