Hide caption doesn't work since MT5 build 2280

 

Hello,


since MT5 build 2280 it's not possible to hide the chart window caption bar with this script

#include <Charts\Chart.mqh>

#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); 
#import


#define GWL_STYLE         -16 
#define WS_CAPTION        0x00C00000 
#define SWP_NOSIZE        0x0001
#define SWP_NOMOVE        0x0002
#define SWP_NOZORDER      0x0004
#define SWP_NOACTIVATE    0x0010
#define SWP_FRAMECHANGED  0x0020


CChart cChart;

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---

   cChart.Attach();
   
   int iChartParent = GetParent(cChart.WindowHandle());
   
   cChart.Detach();
      
   int iNewStyle = GetWindowLongA(iChartParent, GWL_STYLE) & (~WS_CAPTION); 
   
         
   if (iChartParent>0 && iNewStyle>0) {
    SetWindowLongA(iChartParent, GWL_STYLE, iNewStyle);
    
    SetWindowPos(iChartParent,0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE| SWP_FRAMECHANGED);
    
   }             
   
  }


Any idea, why this script no more works ?

 

I also made this unfortunate discovery. The caption becomes unresponsive (yet the close/minimize/maximize boxes still work).

Explored the chart windows with Window Detective, tried to change various window styles. The closest result was applying this:

long Style = GetWindowLongPtrA(chartHandle, GWL_STYLE) & ~(WS_OVERLAPPED | WS_THICKFRAME | WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_DLGFRAME) | WS_MAXIMIZE;
         
if (chartHandle > 0 && Style > 0) {
                
   SetWindowLongPtrA(chartHandle, GWL_STYLE, Style);
   SetWindowPos(chartHandle, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOSENDCHANGING | SWP_SHOWWINDOW | SWP_NOREPOSITION);
}

giving a familiar picture (I almost yelled for victory), but just on first sight:


This is indeed totally unusable; with another chart opened, or just resizing the main window, the damn (unresponsive) caption shows again on top of the chart.

In hindsight, it's logical... the above nonsensical code just freezes the chart content and maximizes the window, but the (maximized) caption is still there :-P

Seems it's impossible to get rid of the MDI children captions anymore - some styles (including imho critical WS_SYSMENU and, most importantly, WS_OVERLAPPED) seem to be reset by MT5 to original state on any change.

My workspace layout consists of totally 10 charts (3 of them being used as UI panels) and must fit on a 1080p laptop screen. The bulkiness of window captions creates a no-go situation to me. MT5 is superb, but I can't migrate without this thing resolved.

After playing with CChart and reckoning the complexity of all things, I temporarily gave up porting my stuff to MT5 (which was originally my planned Christmas holiday's homework).

MT4 still works the old way.


If someone smarter than me knows a solution, I will be endlessly grateful if posted here!

 

I@Tom Iver

Is any solution?

Show full code please...

Tom Iver
Tom Iver
  • 2016.10.28
  • www.mql5.com
Trader's profile