The script has been tested on Windows 8.1 x64.
I'm interested in reviews of the script on other operating systems.
Version 1.10: Now works in "Windows XP 32".
Changes in:
Version 1.20: When re-accession to the schedule, the terminal becomes opaque.
barabashkakvn:
Changes in:
On English codebase, available version is still 1.10.
Changes in:
Version 1.20: When re-accession to the schedule, the terminal becomes opaque.
Version 1.20
//+------------------------------------------------------------------+ //| transparency.mq5 | //| Copyright © 2014, Vladimir Karputov | //| http://wmua.ru/slesar/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2014, Vladimir Karputov" #property link "http://wmua.ru/slesar/" #property version "1.20" #import "user32.dll" //+------------------------------------------------------------------+ //| GetAncestor. Retrieves the handle to the ancestor of the | //| specified window. Извлекает дескриптор предка заданного окна | //+------------------------------------------------------------------+ int GetAncestor(int hwnd,int gaFlags); //+------------------------------------------------------------------+ //| GetWindowLongW. Retrieves information about the specified | //| window. Получает информацию об указанном окне | //+------------------------------------------------------------------+ int GetWindowLongW( int hWnd, int nIndex // GWL_EXSTYLE ); //+------------------------------------------------------------------+ //| SetWindowLongW. Изменяет атрибут заданного окна | //+------------------------------------------------------------------+ int SetWindowLongW( int hWnd, char nIndex, // GWL_EXSTYLE int dwNewLong // WS_EX_LAYERED ); //+------------------------------------------------------------------+ //| SetLayeredWindowAttributes. Sets the opacity and transparency | //| color key of a layered window. Устанавливает светопроницаемость | //| и прозрачность окраски многослойного окна | //+------------------------------------------------------------------+ bool SetLayeredWindowAttributes( int hwnd,// A handle to the layered window int crKey, // 0 int bAlpha, // степень непрозрачности 0-255 int dwFlags // 0x00000002 ); #import #define GA_ROOT 0x0002 // Retrieves the root window by walking the chain of parent windows. #define GWL_EXSTYLE -20 // Sets a new extended window style #define WS_EX_LAYERED 0x00080000 // Style. The window is a layered window. #define LWA_ALPHA 0x00000002 // Use bAlpha to determine the opacity of the layered window. //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- long mainChartID=ChartID(); // возвращает идентификатор текущего графика int hdlmainChartID=ChartWindowsHandle(mainChartID); int hdlRoot=GetAncestor(hdlmainChartID,GA_ROOT); int SetWindowLongW_func; if(GetWindowLongW(hdlRoot,GWL_EXSTYLE)&WS_EX_LAYERED) { // У окна уже есть стиль WS_EX_LAYERED. Удалим WS_EX_LAYERED из этого окна стилей. // Window already has a style WS_EX_LAYERED. Remove WS_EX_LAYERED from this window styles. SetWindowLongW_func=SetWindowLongW(hdlRoot,GWL_EXSTYLE, GetWindowLongW(hdlRoot,GWL_EXSTYLE)&~WS_EX_LAYERED); return; } // Устанавливаем WS_EX_LAYERED на ROOT окно SetWindowLongW_func=SetWindowLongW(hdlRoot,GWL_EXSTYLE, GetWindowLongW(hdlRoot,GWL_EXSTYLE)|WS_EX_LAYERED); SetLayeredWindowAttributes(hdlRoot,0,(255*70)/100,LWA_ALPHA); return; } //+------------------------------------------------------------------+ //| The function gets the handle graphics | //| Функция получает хэндл графика | //+------------------------------------------------------------------+ int ChartWindowsHandle(long chart_ID) { //--- prepare the variable to get the property value //--- подготовим переменную для получения значения свойства long result=-1; //--- reset the error value //--- сбросим значение ошибки ResetLastError(); //--- receive the property value //--- получим значение свойства if(!ChartGetInteger(chart_ID,CHART_WINDOW_HANDLE,0,result)) { //--- display the error message in Experts journal //--- выведем сообщение об ошибке в журнал "Эксперты" Print(__FUNCTION__+", Error Code = ",GetLastError()); } //--- return the value of the chart property //--- вернем значение свойства графика return((int)result); } //+------------------------------------------------------------------+

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Transparent MetaTrader 5:
The script allows to set transparency level of the client terminal window using Windows API.
Author: Karputov Vladimir