還是關(guān)于自動(dòng)連接的問(wèn)題
作者:金字塔 來(lái)源:cxh99.com 發(fā)布時(shí)間:2014年09月03日
- 咨詢(xún)內(nèi)容:
這是我早上VBA自動(dòng)連接后的截圖
此主題相關(guān)圖片如下:捕獲.jpg
在交易時(shí)段,我通過(guò) VBA每一分鐘自動(dòng)判斷當(dāng)前是否連接。從截圖可以看到,通過(guò)VBA連接后,股票行情處于“連接中”狀態(tài),但VBA函數(shù)去判斷連接狀態(tài)時(shí),對(duì)于“連接中”的狀態(tài)也是返回1,即默認(rèn)已連接,但事實(shí)上并沒(méi)有連接成功。
- 金字塔客服:
檢測(cè)部分的VBA代碼貼下
- 用戶(hù)回復(fù):
if ttt>cdate("08:56:00") and ttt<cdate("15:15:00") and application.ReceiveDatastatus=0 then call application.ReceiveData(1) application.MsgOut "已連接! "&date()&" "&time() end if if ttt>cdate("15:15:00") and application.ReceiveDatastatus then call application.ReceiveData(0) application.MsgOut "斷開(kāi)連接! "&date()&" "&time() end if
這個(gè)是每天開(kāi)盤(pán)前自動(dòng)連接,收盤(pán)后自動(dòng)斷開(kāi)!
- 網(wǎng)友回復(fù):
if oautoit.winexists("金字塔") then call oautoit.WinClose("金字塔") 'call oautoit.sleep(1000) application.MsgOut "斷線了!"&date()&" "&time() call application.ReceiveData(0) end ifif ttt>cdate("08:56:00") and ttt<cdate("15:15:00") and application.ReceiveDatastatus=0 then call application.ReceiveData(1) application.MsgOut "已連接! "&date()&" "&time() end if if ttt>cdate("15:15:00") and application.ReceiveDatastatus then call application.ReceiveData(0) application.MsgOut "斷開(kāi)連接! "&date()&" "&time() end if
這段是VBA中的代碼,通過(guò)每分鐘中斷一次來(lái)調(diào)用。當(dāng)出現(xiàn)斷線時(shí),會(huì)彈出“金字塔”的斷線窗口,通過(guò)判斷是否存在該窗口,來(lái)判斷是否斷線 !下面是 每天開(kāi)盤(pán)前自動(dòng)連接,收盤(pán)后自動(dòng)斷開(kāi)!
- 網(wǎng)友回復(fù):
1,帖子轉(zhuǎn)至高級(jí)功能研發(fā)區(qū)。等待相關(guān)人員處理,謝謝