Download MetaTrader 5

ConnectNamedPipe crash mt4 when script are stoped

To add comments, please log in or register
Track all payments in your profile. It is easy!
bisewski
260
bisewski 2014.05.02 00:52 

Hi.

I have a script that connect other program with pipe mode.

while(!IsStopped()) {

bool fConnected = ConnectNamedPipe(hPipe, NULL)!= 0;

if (fConnected) {

The lines above are responsable to wait for this connection.

My problem is that When I dont have any connect and I try to exit this script, it crasch the mt4.

How can I to wait for connections and exit without crash mt4?

Thanks and sorry my english

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.05.02 00:56  
Have you tried to put else ? It crashes most probably because there is no alternative commands to do if not connected.
bisewski
260
bisewski 2014.05.02 01:01  
deysmacro:
Have you tried to put else ? It crashes most probably because there is no alternative commands to do if not connected.

Thanks deysmacro:h but with this command connectnamedpipe stop the script and wait for a connection so I cant use an else because I need to wait for a connection. For this reason, my script are inside a while for run all function and restart again and wait again for a new connection...
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.05.02 01:32  
Show us full code then. Someone will look into if they have spare time. Use SRC when posting codes.
Alain Verleyen
Moderator
30755
Alain Verleyen 2014.05.02 08:54  
bisewski:

Hi.

I have a script that connect other program with pipe mode.

while(!IsStopped()) {

bool fConnected = ConnectNamedPipe(hPipe, NULL)!= 0;

if (fConnected) {

The lines above are responsable to wait for this connection.

My problem is that When I dont have any connect and I try to exit this script, it crasch the mt4.

How can I to wait for connections and exit without crash mt4?

Thanks and sorry my english

Please post code that makes sense and use SRC button as suggested by deysmacro.
To add comments, please log in or register