Floating windows in the next release of MetaTrader 5 - page 2

 
The terminal is getting better!
 
Sergey Savinkin:
Will it be possible to reduce/hide thick chart window frames to save space?

You can check with these scripts. They're working now.

Code for removing the frames

//#property script_show_inputs
#import "user32.dll"
  int SetWindowLongA(int hWnd,int nIndex, int dwNewLong);
  int GetWindowLongA(int hWnd,int nIndex);
  int SetWindowPos(int hWnd, int hWndInsertAfter,int X, int Y, int cx, int cy, int uFlags);
  int GetParent(int hWnd);
  int GetTopWindow(int hWnd);
  int GetWindow(int hWnd, int wCmd);
#import

#define  GWL_STYLE         -16 
#define  WS_CAPTION        0x00C00000 
#define  WS_BORDER         0x00800000
#define  WS_SIZEBOX        0x00040000
#define  WS_DLGFRAME       0x00400000
#define  SWP_NOSIZE        0x0001
#define  SWP_NOMOVE        0x0002
#define  SWP_NOZORDER      0x0004
#define  SWP_NOACTIVATE    0x0010
#define  SWP_FRAMECHANGED  0x0020
#define  GW_CHILD          0x0005
#define  GW_HWNDNEXT       0x0002

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int OnStart() 
{
   int hChartParent = GetParent((int)ChartGetInteger(ChartID(), CHART_WINDOW_HANDLE));    
   int hMDIClient = GetParent(hChartParent); 
   int hChildWindow = GetTopWindow(hMDIClient);
   while (hChildWindow > 0)
   {
      RemoveBorderByWindowHandle(hChildWindow);
      hChildWindow = GetWindow(hChildWindow, GW_HWNDNEXT);
   }
 
   
   return(0);
}
void RemoveBorderByWindowHandle(int hWindow)
{
   int iNewStyle = GetWindowLongA(hWindow, GWL_STYLE) & (~(WS_BORDER | WS_DLGFRAME | WS_SIZEBOX));    
   if (hWindow>0 && iNewStyle>0) 
   {
      SetWindowLongA(hWindow, GWL_STYLE, iNewStyle);
      SetWindowPos(hWindow,0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
   }
}

The code to put the frames back in.

//#property script_show_inputs
#import "user32.dll"
  int SetWindowLongA(int hWnd,int nIndex, int dwNewLong);
  int GetWindowLongA(int hWnd,int nIndex);
  int SetWindowPos(int hWnd, int hWndInsertAfter,int X, int Y, int cx, int cy, int uFlags);
  int GetParent(int hWnd);
  int GetTopWindow(int hWnd);
  int GetWindow(int hWnd, int wCmd);
#import

#define  GWL_STYLE         -16 
#define  WS_CAPTION        0x00C00000 
#define  WS_BORDER         0x00800000
#define  WS_SIZEBOX        0x00040000
#define  WS_DLGFRAME       0x00400000
#define  SWP_NOSIZE        0x0001
#define  SWP_NOMOVE        0x0002
#define  SWP_NOZORDER      0x0004
#define  SWP_NOACTIVATE    0x0010
#define  SWP_FRAMECHANGED  0x0020
#define  GW_CHILD          0x0005
#define  GW_HWNDNEXT       0x0002

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int OnStart() 
{
   int hChartParent = GetParent((int)ChartGetInteger(ChartID(), CHART_WINDOW_HANDLE));    
   int hMDIClient = GetParent(hChartParent); 
   int hChildWindow = GetTopWindow(hMDIClient);
   while (hChildWindow > 0)
   {
      RemoveBorderByWindowHandle(hChildWindow);
      hChildWindow = GetWindow(hChildWindow, GW_HWNDNEXT);
   }
 
   
   return(0);
}
void RemoveBorderByWindowHandle(int hWindow)
{
   int iNewStyle = GetWindowLongA(hWindow, GWL_STYLE) | ((WS_BORDER | WS_DLGFRAME | WS_SIZEBOX));    
   if (hWindow>0 && iNewStyle>0) 
   {
      SetWindowLongA(hWindow, GWL_STYLE, iNewStyle);
      SetWindowPos(hWindow,0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
   }
}
 
Alexey Viktorov:

You can check with these scripts. They're working now.

Code for removing the frames

The code to put the frames back in.

Thanks. But this will probably need to be run every time the terminal is started? Also on every chart.

 

great news.

especially for trading from panels.

 
Sergey Savinkin:

Thank you. But this would probably have to be run every time the terminal is started? Also on every chart.

Not on every chart, that's for sure. I had it for MT4 and for all windows simultaneously and for each window separately. But by trial and error I have remade only these ones for MT5. I didn't pay attention to them when restarting the terminal, though. Somehow, I don't keep several windows open and practically do not use these scripts.

 

Always on top will probably be done, but not transparency. We won't touch the window frames yet.

The window state control is when you draw everything yourself on the canvas or objects.

 
Renat Fatkhullin:

We will most likely do Always on top, but not transparency. We are not going to touch the window frame for now.

Managing the window's state is when you draw everything yourself on canvas or objects.

Renat, great news.

Will it be possible to manage windows within different screens, like MDI? We will probably do all sorts of Tile Horizontally and so on.

 
Mesaoria:

Renat, great news.

Will it be possible to manage windows within different screens, like MDI? Tile Horizontally and so on.

It's a manual job, we don't plan to automate it.
 
Vitaly Muzichenko:

And I'm still 17 :)

And you'll be earning 17 times as much ))


 
Alexey Volchanskiy:

And you'll make 17 times more money ))

No, it would just be convenient to open the symbols in full screen. Right now, if you have more than 4 charts open, it's extremely inconvenient to analyse the charts, and that on a 27 monitor. The working symbols are 15 and for the market analysis I need 3 additional windows - a total of 18 windows.

So the separation of windows is great news!