why are you doing so much work, if you use the MT getwindowhandle() function, you have the handle to the chart window, all you need next is to call the GetParent() function to get the main MT window handle.
When you send key or mouse events you must make sure that the window that you intend to receive the input has the focus or you'll be sending key events to an unintended window. Not only does MT have to have focus but the chart that you want to attach your label to also has the focus and you must move your mouse over to the chart window to receive the mouse click or your label will be on the chart window your mouse is currently over when you send the mouse clicks.
sending key events can be tricky.
Keit
When you send key or mouse events you must make sure that the window that you intend to receive the input has the focus or you'll be sending key events to an unintended window. Not only does MT have to have focus but the chart that you want to attach your label to also has the focus and you must move your mouse over to the chart window to receive the mouse click or your label will be on the chart window your mouse is currently over when you send the mouse clicks.
sending key events can be tricky.
Keit
DislikedMaryJane thank you the pm.
by looking at your code on Input Resizer and googling about Menu's API, I try my luck
hope you can refine and improve the code, only when you're not busy .
here it is the script's code
[php]
//+------------------------------------------------------------------+
//| #test-create-label-using-api.mq4 |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
#import "user32.dll"
//int GetForegroundWindow();
int...Ignored
Trader Keit ... Methods Of A Dirt Road Mad Man....