Connect to ThinkOrSwim using NDDE in .Net

I successfully retrieve DDE data from ThinkOrSwim trading platform in excel using this cell formula:

=TOS|Last!AAPL 

However, when I try to connect to ThinkOrSwim DDE using the NDDE library in a .Net C # application, I get the following error message, which is the same as I would understand that the ThinkOrSwim platform did not start at all:

The client could not connect to "TOS | LAST". Verify that the server application is running and that it supports the specified service name and a pair of names.

The exact same connection method with NDDE worked in 2009 and failed when I reused it in 2012. Perhaps ThinkOrSwim made some changes to their application to block it? I am wondering what to do next ... either find a way to get NDDE to work (better), or run an Excel spreadsheet in my .Net application (randomly).

Hope someone here knows that I can continue using NDDE and fix this connection problem.

Click to download the small code library I created to demonstrate this problem (Visual Studio 2010) . You will need to click File-> Download after loading the page.

Bounty is just the answers showing a solution using a clean .Net / windows api solution. Excel automation inside .Net is not taken for generosity.

Download ThinkOrSwim from: https://mediaserver.thinkorswim.com/installer/InstFiles/thinkorswim_jse6_installer.exe Contact me privately if you need to register.

+6
source share
2 answers

Finally found a solution: I had to run Visual Studio as an administrator to get it working in debugging. To make .exe work, I had to add the app.manifest file with the following:

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> 
+1
source

Right click on thinkorswim.exe, go to the compatibility tab

check the box "Run as administrator" at the bottom.

Click "Apply."

+3
source

Source: https://habr.com/ru/post/922524/


All Articles