|
1 | | -(ns clj-dde.core |
2 | | - [:import |
3 | | - [com.pretty_tools.dde.client DDEClientConversation] |
4 | | - [java.util Date]]) |
5 | | - |
6 | | -(System/getProperty "java.library.path") |
7 | | - |
8 | | -(Date.) |
9 | | - |
10 | | - |
11 | | -;; instantiate a DDEClientConversation |
12 | | - |
13 | | -(def conversation (DDEClientConversation.)) |
14 | | - |
15 | | - |
16 | | -;; ** DDEClientConversation member functions: |
17 | | - |
18 | | -(.connect conversation "excel" "sheet1") |
19 | | - |
20 | | -(.disconnect conversation) |
21 | | - |
22 | | -(.execute conversation "some-string") |
23 | | - |
24 | | -(.execute conversation some-byte) |
25 | | - |
26 | | -(.poke conversation "some-item" "some-data") |
27 | | - |
28 | | -(.poke conversation "some-item" byte-data some-clipboardformat) |
29 | | - |
30 | | -(.request conversation "some-item") |
31 | | - |
32 | | -(.startAdvice conversation "some-item") |
33 | | - |
34 | | -(.stopAdvice conversation "some-item") |
35 | | - |
36 | | -(.getService conversation) |
37 | | - |
38 | | -(.getTopic conversation) |
39 | | - |
40 | | -(.getTimeout conversation) |
41 | | - |
42 | | -(.setTimeout conversation) |
43 | | - |
44 | | -(.getEventListener conversation) |
45 | | - |
46 | | -(.setEventListener conversation an-event-listener) |
47 | | - |
48 | | -(.checkConversation conversation) |
49 | | - |
50 | | -(.fireEventOnDisconnect conversation) |
51 | | - |
52 | | -(.fireEventOnAdvData conversation) |
53 | | - |
54 | | - |
55 | | -; #(com.pretty_tools.dde.client.DDEClientConversation. %) |
56 | | - |
57 | | -; (.. conversation connect setTimeout 2000) |
58 | | -; (.. conversation connect "Excel" "Sheet1") |
59 | | - |
60 | | - |
61 | | -#_(defn get-a-conversation |
62 | | - [] |
63 | | - (DDEClientConversation. com.pretty_tools.dde.client.DDEClientConversation)) |
64 | | - |
65 | | - |
| 1 | +(ns clj-dde.core |
| 2 | + [:import |
| 3 | + [com.pretty_tools.dde.client.DDEClientConversation] |
| 4 | + [com.pretty_tools.dde.client.DDEClientEventListener] |
| 5 | + [com.pretty_tools.dde ClipboardFormat] |
| 6 | + [com.pretty_tools.dde DDEException] |
| 7 | + [com.pretty_tools.dde DDEMLException] |
| 8 | + [java.util Date]]) |
| 9 | + |
| 10 | +(System/getProperty "java.library.path") |
| 11 | + |
| 12 | +(Date.) |
| 13 | + |
| 14 | + |
| 15 | +;; instantiate a DDEClientConversation |
| 16 | + |
| 17 | +;; ** DDEClientConversation member functions: |
| 18 | + |
| 19 | +; (.connect conversation "excel" "sheet1") |
| 20 | +; (.request conversation "R1C1") |
| 21 | +; (.poke conversation "R1C1", "new val") |
| 22 | + |
| 23 | +(def mt4-conv (DDEClientConversation.)) |
| 24 | + |
| 25 | +(.connect mt4-conv "MT4" "BID") |
| 26 | + |
| 27 | +(.startAdvice mt4-conv "EURUSD") |
| 28 | + |
| 29 | +; (.setEventListener mt4-link (DDEClientEventListener)) |
| 30 | + |
| 31 | +; void onItemChanged(String topic, String item, String data); |
| 32 | + |
| 33 | +(defn ELOnItemChanged |
| 34 | + [] |
| 35 | +(reify DDEClientEventListener |
| 36 | + (onItemChanged [this topic item data] |
| 37 | + (str "onItemChanged: " topic " , " item " , " data " )")))) |
| 38 | + |
| 39 | +(defn ELOnDisconnect |
| 40 | + [] |
| 41 | +(reify DDEClientEventListener |
| 42 | + (onDisconnect [this] |
| 43 | + (str "onDisconnect called.")))) |
| 44 | + |
| 45 | +(.setEventListener mt4-conv (ELOnItemChanged)) |
| 46 | + |
| 47 | +(ELOnItemChanged) |
| 48 | + |
| 49 | + |
| 50 | +(str "the" "string" "gets") |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +
|
|
0 commit comments