Download MetaTrader 5

After MetaEditor Update my script have erros - page 3

To add comments, please log in or register
Mr. Trillioner
4808
Mr. Trillioner  
Thank you do not need! the problem was the formation of string for the pipe.
oscarin
6
oscarin  

If someone still has problems managing named pipes in MT4 v600, this is the way I solved it:

  • Changing CreateNamedPipeA and CreateFileA, with CreateNamedPipeW and CreateFileW
  • Changing the declarations in ReadFile and WriteFile (Buffer), so, I can work with CharArrays (1 byte per character):
int WriteFile(int FileHandle, uchar & Buffer[], int BufferLength, int & BytesWritten[], int PassAsZero);

int ReadFile(int FileHandle, uchar & BufferPtr[], int BufferLength, int & BytesRead[], int PassAsZero);

  • Using Char arrays to comunicate between the server and client:

Server:

string ReadBuffer = "";
uchar Buff_in[200];
int BytesRead[1] = {0};
ReadFile(glbPipe[PipeIndex], Buff_in, 200, BytesRead, 0);
ReadBuffer = CharArrayToString(Buff_in,0,BytesRead[0]);
if (BytesRead[0] > 0) {
   strReturnValue = StringConcatenate(strReturnValue, ReadBuffer);   
   TotalBytesRead += BytesRead[0];
} 

Client:

uchar Mess_char[];
StringToCharArray(Message, Mess_char,0);
WriteFile(PipeHandle, Mess_char, StringLen(Message), BytesWritten, 0);
shogunfx
3
shogunfx  
oscarin:

If someone still has problems managing named pipes in MT4 v600, this is the way I solved it:

  • Changing CreateNamedPipeA and CreateFileA, with CreateNamedPipeW and CreateFileW
  • Changing the declarations in ReadFile and WriteFile (Buffer), so, I can work with CharArrays (1 byte per character):

  • Using Char arrays to comunicate between the server and client:

Server:

Client:

Can you please attach the files (client and server examples) with your new code ?

I can't manage to solve communication via Named Pipes with modifications you posted  above.

Thank you.

123
To add comments, please log in or register