41
TradeStation / EasyLanguage
« : 06 Декабря 2018, 11:57:44 »
// Как получить параметры окна стороннего приложения посредством WinAPI, например "Калькулятор". Неделю бъюсь, всё безтолку...ХЕЛП!
// {***Obj} Указатель на структуру, которая принимает экранные координаты левого верхнего и нижнего правого углов окна.
// Как его описать, чтобы можно было получить параметры окна в TDE?
// Предполагаю, должно быть как-то так: Obj.left, Obj.right
// Думаю, разработчики не могли упустить возможность получения данных посредством структуры, но как это сделать? примеров не нашёл...
Using elsystem;
DefineDLLfunc: "user32.dll", // https://www.vsokovikov.narod.ru/New_MSDN_API/Window/fn_findwindow.htm
Long, // https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-findwindowa
"FindWindowA", // Retrieves a handle to the top-level window whose class name and window name match the specified strings.
Long, // * [in] lpClassName: If lpClassName points to a string, it specifies the window class name.
String; // * [in] lpWindowName: The window name (the window's title). If this parameter is NULL, all window names match.
DefineDLLfunc: "user32.dll", // https://www.vsokovikov.narod.ru/New_MSDN_API/Window/fn_getwindowrect.htm
Long, // https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getwindowrect
"GetWindowRect", // Retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
Long, // * [in] hWnd: A handle to the window.
Long; {***Obj} // * [out] lpRect: A pointer to a RECT structure that receives the screen coordinates of the upper-left and lower-right corners of the window.
Vars:
String WindowName ("Калькулятор"), // Предварительно необходимо запустить "Калькулятор"
Int WindowHandle(0),
Int Obj(0); // ***Obj
Once Begin
Clearprintlog;
WindowHandle = FindWindowA(0, WindowName);
If WindowHandle > 0
Then Begin
GetWindowRect(WindowHandle, Obj {***Obj});
{
Print(Obj.left:0:0, Obj.right:0:0);
}
Print(WindowHandle:0:0);
End;
End;
// {***Obj} Указатель на структуру, которая принимает экранные координаты левого верхнего и нижнего правого углов окна.
// Как его описать, чтобы можно было получить параметры окна в TDE?
// Предполагаю, должно быть как-то так: Obj.left, Obj.right
// Думаю, разработчики не могли упустить возможность получения данных посредством структуры, но как это сделать? примеров не нашёл...
Using elsystem;
DefineDLLfunc: "user32.dll", // https://www.vsokovikov.narod.ru/New_MSDN_API/Window/fn_findwindow.htm
Long, // https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-findwindowa
"FindWindowA", // Retrieves a handle to the top-level window whose class name and window name match the specified strings.
Long, // * [in] lpClassName: If lpClassName points to a string, it specifies the window class name.
String; // * [in] lpWindowName: The window name (the window's title). If this parameter is NULL, all window names match.
DefineDLLfunc: "user32.dll", // https://www.vsokovikov.narod.ru/New_MSDN_API/Window/fn_getwindowrect.htm
Long, // https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getwindowrect
"GetWindowRect", // Retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
Long, // * [in] hWnd: A handle to the window.
Long; {***Obj} // * [out] lpRect: A pointer to a RECT structure that receives the screen coordinates of the upper-left and lower-right corners of the window.
Vars:
String WindowName ("Калькулятор"), // Предварительно необходимо запустить "Калькулятор"
Int WindowHandle(0),
Int Obj(0); // ***Obj
Once Begin
Clearprintlog;
WindowHandle = FindWindowA(0, WindowName);
If WindowHandle > 0
Then Begin
GetWindowRect(WindowHandle, Obj {***Obj});
{
Print(Obj.left:0:0, Obj.right:0:0);
}
Print(WindowHandle:0:0);
End;
End;