How to Hide symbol chart's caption?

 

How to Hide symbol chart's Caption and Border? Just like the picture:


I have tried import user32.dll and writed the code, but failed:


#import "user32.dll"

long SetWindowLongA(int hWnd, int nIndex, ulong dwNewLong);

long SetWindowLongW(int hWnd, int nIndex, ulong dwNewLong);

long GetWindowLongA(int hWnd, int nIndex);

long GetWindowLongW(int hWnd, int nIndex);

#import


int start()

{

.....

Print("GetWindowLong=====", GetWindowLongA(lChartWinHandle, -16));     // GWL_STYLE: -16. This Line prints correctly.

long ChartWinHandle = GetParent(WindowHandle(Symbol(), PERIOD_CURRENT));
SetWindowLongW(ChartWinHandle, -16, 0x2000000);     // GWL_STYLE: -16. This Line makes MT4 crashed.
SetWindowLongW(ChartWinHandle, -16, GetWindowLongA(lChartWinHandle, -16));     // GWL_STYLE: -16. This Line print: stack damaged, check DLL function call.
....
}



I am in Win10 64-bit OS. MT4 bulid 1170.

So what the reason for it? Thanks a lot!


And btw, why does MT4 Crashed if i copy "user32.dll" into "..\MQL4\Libraries\"  ?

 
hi, use option maximize ( middle button on your picture with red frame). Regards Greg
 
those are MDI child window.
 
Greg Pawlak:
hi, use option maximize ( middle button on your picture with red frame). Regards Greg

Bro, you mean pressing F11 button?   Or Enter in Menu->Display->Full Screen? no no no...

What i need is to hide every child's caption and border, thank you!

 
Soewono Effendi:
those are MDI child window.
Yes, i know it is MDI child windows.

Maybe my words upper are not clear, so i upload anther pictrue for clearance.

What i need is to hide every child's caption and border, thank you!

 
long_a17:
Yes, i know it is MDI child windows.

Maybe my words upper are not clear, so i upload anther pictrue for clearance.

What i need is to hide every child's caption and border, thank you!

that's exactly the point ....

for MDI childs the method to hide maybe different.

 

Copy this code, paste it to a new Indicator, compile it. 


//+------------------------------------------------------------------+
//|                                                 RemoveBorder.mq4 |
//|                         Copyright 2018-2019, Rafael Prado Rocchi |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018-2019, Rafael Prado Rocchi"
#property link      "https://www.mql5.com/en/users/rrocchi"

#property indicator_chart_window


extern int win1 = 1;
extern int Adjust_Side_to_side = 0;
extern int Shift_UP_DN = 0;

#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 WS_DLGFRAME       0x00400000
#define SWP_NOSIZE        0x0001
#define SWP_NOMOVE        0x0002
#define SWP_NOZORDER      0x0004
#define SWP_NOACTIVATE    0x0010
#define SWP_FRAMECHANGED  0x0020
#define SWP_NOSENDCHANGING 0x0400
#define SWP_SHOWWINDOW     0x0040
#define SWP_NOREPOSITION   0x0200
#define WS_TILED           0x00000000


#define janela_inferior 1
int ticks=0;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
    
   IndicatorShortName(" ");
  
   int iChartParent=GetParent(WindowHandle(Symbol(),0));    
   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|SWP_NOSENDCHANGING|SWP_SHOWWINDOW|SWP_NOREPOSITION);
   }
    
  return(0);
}

//+-------------------------------------+
//| Deinit                              |
//+-------------------------------------+
void OnDeinit(const int reason) {
   return; 
}
 

void start() {
   return;
}



//+------------------------------------------------------------------+


Open any chart window, drop this indicator to the window.





Border will be gone:



For Metatrader 4

 
long_a17:


And btw, why does MT4 Crashed if i copy "user32.dll" into "..\MQL4\Libraries\"  ?


By the way, you should not copy user32.dll anywhere. Leave it where it originally is.

 
rrocchi:

Copy this code, paste it to a new Indicator, compile it. 



Open any chart window, drop this indicator to the window.





Border will be gone:



For Metatrader 4


OMG, Dear Bro, Thank you so much!!!

It works now, all caption of charts are hidden now!!!

And How to hide the Border of every chart? I use the following code, but not work:

#define GMEM_MOVEABLE   2
#define CF_UNICODETEXT  13

#define GWL_STYLE          -16 
#define WS_CAPTION         0x00C00000
#define WS_BORDER       0x00800000
#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 SWP_NOSENDCHANGING 0x0400
#define SWP_SHOWWINDOW     0x0040
#define SWP_NOREPOSITION   0x0200
#define WS_TILED           0x00000000
      

int iChartParent = GetParent(WindowHandle(ChartSymbol(lArrayChartID[y]),0));
int iNewStyle    = GetWindowLongA(iChartParent, GWL_STYLE) & (~WS_CAPTION)& (~WS_BORDER);
        
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
                        |SWP_NOSENDCHANGING
                        |SWP_SHOWWINDOW
                        |SWP_NOREPOSITION
                      );
}

Thank you for warmly and professionally help!!! :-)

 
long_a17:


OMG, Dear Bro, Thank you so much!!!

It works now, all caption of charts are hidden now!!!

And How to hide the Border of every chart? I use the following code, but not work:

Thank you for warmly and professionally help!!! :-)

You can't remove that thin border (at least I know no way to remove it)

but you can make it super-thin like the picture I posted (if yours is large) by adjusting the border size under Windows Display Settings -> Advanced -> Border (set to value=1)

 
rrocchi:

You can't remove that thin border (at least I know no way to remove it)

but you can make it super-thin like the picture I posted (if yours is large) by adjusting the border size under Windows Display Settings -> Advanced -> Border (set to value=1)

Thank you bro, and follow your idea, i found the way in Win10:

1. Run regedit.exe

2. "HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\"

3. Change "PaddedBorderWidth" to 0   (Maybe its default value is -60)

4. Reboot and Done.

Thank you bro  :-)

Reason: