Exchanging data between MC and C#
-
- Posts: 83
- Joined: 18 Mar 2013
- Has thanked: 11 times
Exchanging data between MC and C#
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: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Exchanging data between MC and C#
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?
- Smoky
- Posts: 518
- Joined: 03 Dec 2010
- Location: Thailand
- Has thanked: 99 times
- Been thanked: 121 times
Re: Exchanging data between MC and C#
the only way who works today is GlobalVariables ....
@JoshM
MC does not use all of them, you can use these solutions if you have source-code of the two applications
@JoshM
MC does not use all of them, you can use these solutions if you have source-code of the two applications
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Exchanging data between MC and C#
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.
Re: Exchanging data between MC and C#
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