How to programatically minimize a chart window? - page 2

 
mar:

I tried it this way now:

But when I drag that script to an open chart the whole MT4 freezes and I have to close MT4 and reopen it again.

I have no idea if ShowWindow() is really the correct Win32 function to do that. I have looked in different C++ forums but maybe this function can't be used in MQL4. 

But there is absolutely no command to minimize the window when using SendMessage(). Additionally I tried to find out how to get the state of a window (minimized, maximized, normal) but again without success.

GetWindowPlacement() might be a good idea but that goes way beyond my knowledge. I have absolutely no idea how to work with this WINDOWPLACEMENT structure. Examples are only given in C++ or C# and I can't get the solution there. Maybe it'snot possible with MQL4..

https://msdn.microsoft.com/de-de/library/windows/desktop/ms633518(v=vs.85).aspx 


This worked for me to minimize a chart window:

#include <WinUser32.mqh>

#define SW_SHOWMINIMIZED 11

void OnStart() {    int hWnd = WindowHandle(Symbol(), Period());    int parent = GetParent(hWnd);    ShowWindow(parent, SW_SHOWMINIMIZED); }
 
Tim Barnard:

This worked for me to minimize a chart window:

Thanks Tim!
 
Great post. It also worked for me!!! Thank you!!!