Exchanging data between MC and C#
-
- Posts: 83
- Joined: Mar 18 2013
- Has thanked: 11 times
Just wondering whether it can be done? Maybe write to text and reading from text may be an option but is there a better option?
- JoshM
- Posts: 2196
- Joined: May 20 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
If 'better' means quicker than writing to a file, you can take a look at pipes:
Pipe Operations in the .NET Framework
Communicating between Processes using Pipes in C#
How to send messages between c++ .dll and C# app using named pipe?
Pipe Operations in the .NET Framework
Communicating between Processes using Pipes in C#
How to send messages between c++ .dll and C# app using named pipe?
- JoshM
- Posts: 2196
- Joined: May 20 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Can C# access the GlobalVariables set by MC? If so, how? That would be quite awesome and convenient.the only way who works today is GlobalVariables ....
I don't follow/understand "MC does not use all of them". What should MC use of them?@JoshM
MC does not use all of them, you can use these solutions if you have source-code of the two applications
But you don't need the source code of the application to work with pipes; a C# app or a MC .NET script can access/write to the pipe, and a C++ DLL used in a MultiCharts script can be the other part of the pipe.
Pipes are a stream just like the StreamWriter and StreamReader classes used in C# to write and read from a file, respectively.
Not sure if it answer your questionJust wondering whether it can be done? Maybe write to text and reading from text may be an option but is there a better option?
I do transfert data between MC and in my case Excel using Global Variable and also a Text file
I had to switch to the text file when I installed MC 64. Excel still running in 32 so Global Variable where not anymore compatible
Data are stored in a CSV style string and I use a function Splitstring(x) to go fetch the desired portion of the string. If you ever need, I made the function available. Just search on the site
Martin