Editing inputs in the order window with dll

 

Hello everyone,

I'm trying to create a library that can open trades the same way a trader sitting in front of MT4 will open trades.

So far, I've been able to bring up the order window and simulate a keystroke on it. However I've been unable to edit any of the fields or even click on the "sell by market" or "buy by market" button. I know it's a huge ask but could anyone point me in the right direction, maybe an article that details what I'm trying to do, or if possible a code snippet showing how to edit one or more of the parameters.

I've read the documentation for the PostMessage(), and it just seems like the explanations are meant for developers who already understand the concept, have also searched countless articles and none seem to detail what I want to do, or even come remotely close to it, maybe am the one who's not just seeing it, hence  this post.

So if you could please take out a little bit of your time to help on this matter, I'll deeply appreciate it.


Here's my existing code

#include <WinUser32.mqh>
 #import "user32.dll"
 
 int GetAncestor(int, int);
 int FindWindowW(string lpszClass,string lpszWindow);
 int PostMessageW(int hwnd,int msg,int wparam,uchar &Name[]);
 #import

#define MT4_WMCMD_ORDER_MARKET    35458 /* new order (F9) */

void OnStart()
{
//---
 int window = WindowHandle(Symbol(), Period());
 int main = GetAncestor(window, 2/*GA_ROOT*/);
 PostMessageW(main, WM_COMMAND,  MT4_WMCMD_ORDER_MARKET, 0 ) ;    // Open New Order Window
 Sleep(10);
 int handle = FindWindowW(NULL,"Order");
 uchar name2[];
 StringToCharArray("Order",name2,0);
 PostMessageW(handle,0x100,15,name2);                   // Simulate enter on New Order Window
}
 
Did you manage to find a solution for it?
Reason: