Код:
//+----------------------------------------------------------------------------------------------------+
//| windowresize.mq5 |
//+----------------------------------------------------------------------------------------------------+
#import "user32.dll"
int GetParent(int hWnd);
bool SetWindowPos(int hWnd, int hWndInsertAfter, int x, int y, int width, int height, uint uFlags);
void keybd_event(int bVk, int bScan, int dwFlags, int dwExtraInfo);
#import
void OnStart()
{
if(ChartGetInteger(0,CHART_IS_MAXIMIZED,0)==1)
{
keybd_event(0x12,0,0,0);
keybd_event(0x52,0,0,0);
keybd_event(0x12,0,0x0002,0);
keybd_event(0x52,0,0x0002,0);
}
long FirstChartID = ChartFirst();
long SecondChartID = ChartNext(FirstChartID);
long ThirdChartID = ChartNext(SecondChartID);
long FourthChartID = ChartNext(ThirdChartID);
long FirstChartHandle, SecondChartHandle, ThirdChartHandle, FourthChartHandle;
int FirstChartParentHandle, SecondChartParentHandle, ThirdChartParentHandle, FourthChartParentHandle;
ChartGetInteger(FirstChartID,CHART_WINDOW_HANDLE,0,FirstChartHandle);
ChartGetInteger(SecondChartID,CHART_WINDOW_HANDLE,0,SecondChartHandle);
ChartGetInteger(ThirdChartID,CHART_WINDOW_HANDLE,0,ThirdChartHandle);
ChartGetInteger(FourthChartID,CHART_WINDOW_HANDLE,0,FourthChartHandle);
FirstChartParentHandle=GetParent(FirstChartHandle);
SecondChartParentHandle=GetParent(SecondChartHandle);
ThirdChartParentHandle=GetParent(ThirdChartHandle);
FourthChartParentHandle=GetParent(FourthChartHandle);
SetWindowPos(FourthChartParentHandle,0,1276,0,640,958,0);
SetWindowPos(ThirdChartParentHandle,0,900,0,640,958,0);
SetWindowPos(SecondChartParentHandle,0,450,0,640,958,0);
SetWindowPos(FirstChartParentHandle,0,0,0,620,958,0);
}
//+----------------------------------------------------------------------------------------------------+
Кейбд_евент изпраща команда алт+Р за мозаично подреждане на графиките ако графиката е максимизирана, т.е. вече работи и на максимизирана графика.