#import "user32.dll"
int GetWindow (int, int);
int FindWindowExA (int, int, string, string);
int GetParent (int hWnd);
bool GetCursorPos (int& Pos[2]);
bool GetWindowRect (int hWnd,int& Pos[4]);
int GetKeyState (int button);
void mouse_event (int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
int GetAncestor (int hWnd, int gaFlags);
int GetWindowTextLengthA (int);
int GetWindowTextA (int, string, int);
#import
#import "gdi32.dll" int GetPixel (int hDC, int x, int y);
int Pos[2];
int rect[4];
int hwnd, hg, h;
int X, Y;
string Name = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234";
int deinit() {ObjectsDeleteAll();Comment ("");}
int start() {
ObjectsDeleteAll(); Comment ("");
int hwnd = GetAncestor (WindowHandle(Symbol(),Period()),2); //дескриптор основного окна терминалаint temp = GetWindow (hwnd, 5);
int Count = GetWindowTextLengthA (temp); GetWindowTextA (temp, Name, Count+1);
if (Name != "Стандартная" || Name == "Графики" || Name == "Графические инструменты") {
for (int i=0;i<10;i++) {
temp = GetWindow (temp, 2); if (temp == 0) break;
Count = GetWindowTextLengthA (temp); GetWindowTextA (temp, Name, Count+1);
if (Name == "Стандартная" || Name == "Графики" || Name == "Графические инструменты") {hg = temp; break;}
}
} else hg = temp;
int h = GetWindow (hg, 5);
Count = GetWindowTextLengthA (h); GetWindowTextA (h, Name, Count+1);
if (Name != "Графики") {
for (i=0;i<10;i++) {
h = GetWindow (h, 2); if (h == 0) break;
Count = GetWindowTextLengthA (h); GetWindowTextA (h, Name, Count+1);
if (Name == "Графики") break;
}
}
Print (DecToHex(h,8));
while (!IsStopped()) {
GetWindowRect (h,rect);
GetCursorPos (Pos);
X = Pos[0] - rect[0];
Y = Pos[1] - rect[1];
Comment ("X= ",X,"\n","Y= ",Y); Sleep(100);
}
return(0);
}
string DecToHex (int n, int dig) {
string s[], r="";
string Sym[16] = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"};
ArrayResize (s,dig);
for (int i=0; i<dig; i++) s[i]="0";
i = dig-1;
while (n != 0) {s[i] = Sym[n%16]; n = n>>4; i--; }
for (i=0; i<dig; i++) r=r+s[i];
return (r);
}
OK, I'll look elsewhere for a solution to this issue.
Sorry for the inconvenience...
There, in the header, the code and example. There is no need to be offended. What you are doing has long been solved many times on this forum in different versions. You just need to look at the WinUser32.mqh header file, which my library has. All the control codes are there. I have already written about it several times.
Zhunko: There, in the header, is a code and example.
Copy here what you consider an example for this question ?!
I only found this:
// 3.1.1 Function enables/disables auto-scrolling of the specified chart. void ServiceAutoScroll(int hwndChart); // System descriptor of the chart window, on which autoscroll is disabled. //===================================================================================================================================================================== // 3.1.2. The function enables/disables the shift of the specified chart. If successful, method returns TRUE, otherwise - FALSE. bool ServiceShift(int hwndChart); // System descriptor of the chart window, on which the shift is enabled/disabled.
If this function here, I still need its internals ...
// 3.2.1 The function returns the auto-scrolling state of the specified graph. If successful, the function returns TRUE, otherwise FALSE. bool ServiceGetAutoScroll(int hwndChart); // System descriptor of the chart window, from which the auto-scroll state is returned.
Copy here what you think is an example on the subject ?!
I only found this:
// 3.1.1. The function enables/disables auto-scrolling of the specified chart. void ServiceAutoScroll(int hwndChart); // The system descriptor of the chart window, on which the autoscroll is disabled.
// 3.1.2. function enables/disables the shift of the specified chart. The method returns TRUE if successful, otherwise FALSE. bool ServiceShift(int hwndChart); // System descriptor of the chart window, on which the shift is enabled/disabled.
But you don't need it !
I wasn't talking about the library. But if it's about a library, there's a function:
// 3.2.1. Функция возвращает состояние автопрокрутки на указанном графике. В случае успеха функция возвращает TRUE, иначе - FALSE.bool ServiceGetAutoScroll(int hwndChart); // Системный дескриптор окна графика, с которого возвращается состояние автопрокрутки.
I wrote above about WinUser32.mqh. The control codes are there.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
int max = SendMessage ( hwndTaskbar, TB_BUTTONCOUNT, 0, 0);
Please tell me where to see all values of constants like: TB_BUTTONCOUNT, TB_ISBUTTONPRESSED ?!
I want to determine the button and its state !
What toolbar command can be used to scroll through the buttons and find the right one?
Has anyone done this?
The graphics window descriptor has been found:
int deinit() {ObjectsDeleteAll();Comment ("");}int start() { ObjectsDeleteAll(); Comment (""); int hwnd = GetAncestor (WindowHandle(Symbol(),Period()),2); //дескриптор основного окна терминала int temp = GetWindow (hwnd, 5); int Count = GetWindowTextLengthA (temp); GetWindowTextA (temp, Name, Count+1); if (Name != "Стандартная" || Name == "Графики" || Name == "Графические инструменты") { for (int i=0;i<10;i++) { temp = GetWindow (temp, 2); if (temp == 0) break; Count = GetWindowTextLengthA (temp); GetWindowTextA (temp, Name, Count+1); if (Name == "Стандартная" || Name == "Графики" || Name == "Графические инструменты") {hg = temp; break;} } } else hg = temp; int h = GetWindow (hg, 5); Count = GetWindowTextLengthA (h); GetWindowTextA (h, Name, Count+1); if (Name != "Графики") { for (i=0;i<10;i++) { h = GetWindow (h, 2); if (h == 0) break; Count = GetWindowTextLengthA (h); GetWindowTextA (h, Name, Count+1); if (Name == "Графики") break; } } Print (DecToHex(h,8)); while (!IsStopped()) { GetWindowRect (h,rect); GetCursorPos (Pos); X = Pos[0] - rect[0]; Y = Pos[1] - rect[1]; Comment ("X= ",X,"\n","Y= ",Y); Sleep(100); } return(0); }string DecToHex (int n, int dig) { string s[], r=""; string Sym[16] = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; ArrayResize (s,dig); for (int i=0; i<dig; i++) s[i]="0"; i = dig-1; while (n != 0) {s[i] = Sym[n%16]; n = n>>4; i--; } for (i=0; i<dig; i++) r=r+s[i]; return (r); }I don't get it... What for?! I'm very surprised. Have you looked at my header? Not according to the code.
Any command from a chart is one function, one line of code.
I don't get it... What for?! I'm very surprised. Have you looked at my header? Not according to the code.
Any command from a chart is one function, one line of code.
OK, I'll look elsewhere for a solution to this question.
Sorry for the inconvenience.
OK, I'll look elsewhere for a solution to this issue.
Sorry for the inconvenience...
There, in the header, is a code and example.
Copy here what you consider an example for this question ?!
I only found this:
// 3.1.1 Function enables/disables auto-scrolling of the specified chart.
void ServiceAutoScroll(int hwndChart); // System descriptor of the chart window, on which autoscroll is disabled.
//=====================================================================================================================================================================
// 3.1.2. The function enables/disables the shift of the specified chart. If successful, method returns TRUE, otherwise - FALSE.
bool ServiceShift(int hwndChart); // System descriptor of the chart window, on which the shift is enabled/disabled.
But you don't need it !
Copy here what you think is an example on the subject ?!
If this function here, I still need its internals ...
// 3.2.1 The function returns the auto-scrolling state of the specified graph. If successful, the function returns TRUE, otherwise FALSE.
bool ServiceGetAutoScroll(int hwndChart); // System descriptor of the chart window, from which the auto-scroll state is returned.
Copy here what you think is an example on the subject ?!
I only found this:
// 3.1.1. The function enables/disables auto-scrolling of the specified chart.
void ServiceAutoScroll(int hwndChart); // The system descriptor of the chart window, on which the autoscroll is disabled.
// 3.1.2. function enables/disables the shift of the specified chart. The method returns TRUE if successful, otherwise FALSE.
bool ServiceShift(int hwndChart); // System descriptor of the chart window, on which the shift is enabled/disabled.
But you don't need it !
I wasn't talking about the library. But if it's about a library, there's a function:
I wrote above about WinUser32.mqh. The control codes are there.