This forum is now read-only. You can discuss you questions on Forums of MQL4.community and MQL5.community

MT4 shutting down?


Back to topics list
avatar
32
robpec 2008.04.22 15:25 
I'm running an EA with dll protection -- the name of the EA doesn't matter. It connects to a central server for authentication. My problem is the instance of MT4 I'm running it on keeps completely shutting down. I've never experienced this before. Is it possible the dll is causing this or the authentication server is not working properly, disconnecting me and shutting down MT4?

The computer running this is also running other MT4's, and they are all fine. I've never run anything that had the ability to completely shut down MT4. Is this possible? Thanks
avatar
Moderator
4464
Slawa 2008.04.22 19:38 
Close terminal from MQL4-script

//+------------------------------------------------------------------+
//|                                                CloseTerminal.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#include <WinUser32.mqh>
 
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
   int hwnd=WindowHandle(Symbol(),Period());
   int hwnd_parent=0;
//----
   while(!IsStopped())
     {
      hwnd=GetParent(hwnd);
      if(hwnd==0) break;
      hwnd_parent=hwnd;
     }
   if(hwnd_parent!=0)
      PostMessageA(hwnd_parent,WM_CLOSE,0,0);
//----
   return(0);
  }
//+------------------------------------------------------------------+

avatar
32
robpec 2008.04.22 19:54 
Are you saying this is what's causing my problem, or do I need this to prevent it?

Close terminal from MQL4-script

//+------------------------------------------------------------------+
//|                                                CloseTerminal.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#include <WinUser32.mqh>
 
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
   int hwnd=WindowHandle(Symbol(),Period());
   int hwnd_parent=0;
//----
   while(!IsStopped())
     {
      hwnd=GetParent(hwnd);
      if(hwnd==0) break;
      hwnd_parent=hwnd;
     }
   if(hwnd_parent!=0)
      PostMessageA(hwnd_parent,WM_CLOSE,0,0);
//----
   return(0);
  }
//+------------------------------------------------------------------+


Back to topics list