Using DLL to get lot size from One Click Trading

 

Hi, I want to use dll files to get lot size from One Click Trading

My Progress, I got the handle of that edit box using below code:

#import "user32.dll"
   int FindWindowW(string className, string windowName);
   int FindWindowExW(int hwndParent, int hwndChildAfter, string className, string windowName);
   int GetWindowTextW(int hWnd, string lpString, int nMaxCount);
   int GetParent(int hWnd);
   int SendMessageW(int hWnd, int Msg, int wParam, string lParam);
#import
   int hwndMT4 = FindWindowW("MetaQuotes::MetaTrader::4.00", NULL);
   if (hwndMT4 == 0)
      return -1;

   int hwndMDIClient = FindWindowExW(hwndMT4, 0, "MDIClient", NULL);
   if (hwndMDIClient == 0)
      return -2;

   int hwndAboveChart = FindWindowExW(hwndMDIClient, 0, "Afx:00610000:b:00010003:00000006:000715CD", NULL);
   if (hwndAboveChart == 0)
      return -3;

   int hwndChart = FindWindowExW(hwndAboveChart, 0, "AfxFrameOrView140s", NULL);
   if (hwndChart == 0)
      return -4;

   int hwndEdit = FindWindowExW(hwndChart, 0, "Edit", NULL);
   if (hwndEdit == 0)
      return -5;

Afx:00610000:b:00010003:00000006:000715CD -> This value changes on restart, I use WinSpy++ tool to see this value(Will do something to not need them once I get the lot size value) (WinSpy++ attached below)

hwndEdit -> This variable gets the handle of the main edit box that contains the lot size


But I am unable to get the lot size, I have tried below:

1.)

// Get the lot size text from the edit box
   string lotSizeText;
   GetWindowTextW(hwndEdit, lotSizeText, 31);

Doesn't do anything and I do not get anything in my variable

2.)

// Get the lot size text from the edit box
   string lotSizeText;
   const int WM_GETTEXT = 0x000D;
   SendMessageW(hwndEdit, WM_GETTEXT, 31, lotSizeText);

Again, Doesn't do anything


I was happy finally finding the Edit box handle but I can't get the text out of it, It's the worst

Some help will be really appreaciated

Files:
WinSpy17.zip  59 kb
 
Is this a chapgpt code?
 
Moatle Thompson #:
Is this a chapgpt code?
No, Why would you think that?
Though I used it to get some knowledge about dll file creation and how are thing happening. 
 
have you tried 
GetWindowTextA

A variant of api?

 
Farrukh Aleem #:
have you tried 

A variant of api?

Of course, I tried it, It doesn't work at all, I do not get any windows handle, That's why I am using W variant