[問題] python抓dde server的資料

看板Python作者 (體重突破所有均線)時間14年前 (2009/12/17 16:59), 編輯推噓0(0013)
留言13則, 2人參與, 最新討論串1/1
我的狀況如下 windows下有個看盤軟體,日盛的HTS 它有提供一個叫DDEExcel.exe 可以向HTS要資料 現在我想利用python向DDEExcel.exe要資料 是可行的嗎? 我目前找到是有一個wind32ui 似乎可以做到這件事 找到的範例如下: import win32ui import dde #create a DDE client and start conversation s = dde.CreateServer() #the parameter in brackets is the name of this Python file (AddLayers.py) s.Create("AddLayers") #create a conversation between client and server c = dde.CreateConversation(s) #Connect to PhotoModeler c.ConnectTo("PhotoModeler", "Data") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 請問一下我connectTo裡要填什麼東西? 謝謝 註: 這個DDEExcel.exe run起來之後 其實用drag and drop到excel excel上就會有資料 本來的想法是用vb去excel抓資料 但是我用vb2005和vb2008 在excel lib那邊一直搞不太起來 reference那邊該加的應該都加了 但是一用excel.xxx 就跑undefine 也不知哪裡出了問題囧(我是vb新手) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.130.51.127

12/17 17:13, , 1F
你在 drag and drop 到 excel 成功後,把 excel 的格子移到
12/17 17:13, 1F

12/17 17:15, , 2F
那格上,可以在 excel 上方看到函式,格式像是 =A!B!C 這樣
12/17 17:15, 2F

12/17 17:15, , 3F
c.ConnectTo(A, B) 連上 server
12/17 17:15, 3F

12/17 17:16, , 4F
c.Request(C) 得到資料
12/17 17:16, 4F

12/17 17:17, , 5F
A, B, C 三個都是字串
12/17 17:17, 5F

12/17 17:23, , 6F
忘了說,python 抓 dde 好像不怎麼快喔
12/17 17:23, 6F

12/17 17:24, , 7F
我之前測,一秒鐘只能抓 2000 筆 DDE 資料
12/17 17:24, 7F

12/17 17:25, , 8F
你要拿來看盤要考慮一下速度夠不夠
12/17 17:25, 8F

12/17 17:26, , 9F
不過我電腦是四年前的老電腦了,我也不清楚瓶頸在哪裡
12/17 17:26, 9F

12/17 18:04, , 10F
喔喔喔,感謝,等下來試試
12/17 18:04, 10F

12/17 18:28, , 11F
不好意思現在有另一個問題,我找不到dde module囧
12/17 18:28, 11F

12/17 18:34, , 12F
找到了,原來要先import win32ui ...
12/17 18:34, 12F

12/17 22:39, , 13F
1樓感恩喔,謝謝你
12/17 22:39, 13F
文章代碼(AID): #1BAVBqSz (Python)