|
excel 的 vba 改寫為au3
遇到 addressof 不知道au3如何對應
請高手幫幫忙.出手相助.幫忙改寫以下程序
非常感激
Option Explicit
Declare Function SKQuoteLib_Initialize Lib "SKQuoteLib.dll" (ByVal strID As String, ByVal strPass As String) As Long
Declare Function SKQuoteLib_EnterMonitor Lib "SKQuoteLib.dll" () As Long
Declare Function SKQuoteLib_AttachConnectionCallBack Lib "SKQuoteLib.dll" (ByVal Func As Long) As Long
Declare Function SKQuoteLib_AttachQuoteCallBack Lib "SKQuoteLib.dll" (ByVal Func As Long) As Long
Declare Function SKQuoteLib_GetStockByIndex Lib "SKQuoteLib.dll" (ByVal Market As Integer, ByVal Index As Integer, ByRef Stock As TStock) As Long
Type TStock
Stockidx As Integer
Decimal As Integer
TypeNo As Integer
MarketNo As Byte
StockNo As String * 20
StockName As String * 10
Open As Long
High As Long
Low As Long
Close As Long
TickQty As Long
Ref As Long
Bid As Long
Bc As Long
Ask As Long
Ac As Long
TBc As Long
TAc As Long
FutureOI As Long
TQty As Long
YQty As Long
Up As Long
Down As Long
End Type
Public Function Login(ByVal AcNo As String, ByVal Pwd As String) As Integer
Dim Status As Long
Status = Status + SKQuoteLib_Initialize(AcNo, Pwd)
Status = Status + SKQuoteLib_AttachConnectionCallBack(AddressOf OnConnectionBack)
Status = Status + SKQuoteLib_AttachQuoteCallBack(AddressOf OnQuoteCallBack)
'Status = Status + SKQuoteLib_AttachTicksCallBack(AddressOf OnTicks)
'Status = Status + SKQuoteLib_AttachBest5CallBack(AddressOf OnBest5)
If Status = 0 Then
Status = SKQuoteLib_EnterMonitor()
Login = 0
Else
Login = -1
End If
End Function
Sub OnConnectionBack(ByVal Kind As Long, ByVal Code As Long)
If Code = 0 Then
MsgBox "登入成功!!"
Else
MsgBox "中斷!!"
End If
End Sub
Sub OnQuoteCallBack(ByVal Market As Integer, ByVal Index As Integer)
On Error Resume Next
Dim Status As Long, Stock As TStock, ComId As String, Dot As Integer
Status = SKQuoteLib_GetStockByIndex(Market, Index, Stock)
End Sub |
|