Automation with button and mouse click interception. - page 2

 
Avals >> :

The "int GetLastKeyLP()" and "int GetLastMouseLP()" functions available in the same library should help. And use the result in functions int SendMessageA (int hWnd, int Msg, int wParam, int lParam); int PostMessageA (int hWnd, int Msg, int wParam, int lParam);

My terminal crashes all the time when called.


int hwnd = WindowHandle(Symbol(),Period());
SendMessageA(hwnd, WM_COMMAND, 514, 0);


и


int hwnd = WindowHandle(Symbol(),Period());
PostMessageA(hwnd, WM_COMMAND, 514, 0);


Although the script running outputs this code when I press strategy tester button in the toolbar


2008.11.14 15:26:58 shablon EURUSD,Weekly: Mouse Code=513 from window EURUSD,Weekly

 

514 what is it?

#import "user32.dll"
   int GetParent (int hWnd);
   int PostMessageA (int hWnd, int Msg, int wParam, int lParam);
#import
//+------------------------------------------------------------------+

   int hwnd = WindowHandle(Symbol(), NULL);

   while (!IsStopped())   {
     hwnd = GetParent( hwnd);
     if ( hwnd==0) break;
     int hwnd_parent = hwnd;   }

   PostMessageA( hwnd_parent, WM_COMMAND,33315,0)


Something like this, try it.

 
sabluk >> :

514 what is it?


The code returned by the shablon script.

Continuing the theme, how to push the start button now.

Only if you can not code exactly how to press it, but I want to know the principle of how this value is pulled out.

 

I gave you a link to a list of commands

You can catch it yourself with a program like Winspector Spy

 
HIDDEN >> :

The code returned by the shablon script.

Continuing with the theme, how to push the start button now.

Only if you can not code exactly how to push, but want to know the principle of how this value is pulled out.

I recommend the Spy++ utility which is part of the Visual Studio distribution.

 
Ilnur >> :

I recommend you Spy++ utility which is part of Visual Studio distribution kit.

I put the program on, tried it and didn't understand a thing. I have already checked on buttons with a known code, the program does not display it.

Or I'm doing something wrong. If you have experience with the program, make a screenshot of how it outputs the code button from the terminal. I can not find the code.


For example these are the codes how to get out with the help of a program


33018 - switch to "bars" view
33019 - switch to "candlestick" view.
33022 - switch to "line" representation

 

corrected the script works like this

#import "user32.dll"
   int GetParent (int hWnd);
   int PostMessageA (int hWnd, int Msg, int wParam, int lParam);
#import
#define WM_COMMAND       0x0111
//+------------------------------------------------------------------+
int start()
{
   int hwnd = WindowHandle(Symbol(), NULL);

   while (!IsStopped())   {
     hwnd = GetParent( hwnd);
     if ( hwnd==0) break;
     int hwnd_parent = hwnd;   }

   PostMessageA( hwnd_parent, WM_COMMAND,33315,0);
   return(0);
}
//+------------------------------------------------------------------+
 
try other codes from the list in that branch instead of 33315
 
sabluk >> :
Try other codes from the list in the branch instead of 33315

I am not interested in checking the codes, but how to find out the codes. I need to call the tester and press the Start button on the tester and then press the buttons. In order to press all these, I need to understand how to find out these codes.


>> and the code you gave me, I fixed it myself.

 

It's just that from that thread it's not quite clear to me how to switch to a tester window. i.e. find out the window Handle and then run the loop. But the problem is that this approach is not very good, the terminal often crashes.

Reason: