Why the Windows API can't work properly?

 

My code is:

-------------------------------------------------------------------------- 

#include <WinUser32.mqh>
#property indicator_chart_window
extern string RcvWndCaption="Calculator";
int RcvWndHdl;//Receive window handle
int init()
  {  
   //Seek the receive window and get its handle

     RcvWndHdl=FindWindowA("",RcvWndCaption);
   if (RcvWndHdl>0)
       Print(" Receive window ",RcvWndCaption," is found!");
   else
       Print(" Receive window ",RcvWndCaption," is not found!");
   Print("RcvWndHdl=",RcvWndHdl);
   return(0);
  } 

-------------------------------------------------------------------------- 

Compiling and running are correct,but the result is:

Receive window Calculator is not found!

 RcvWndHdl=0

 ---------------------------------------------------------------------------

My purpose is that send data to external window of other program.

Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
  • www.mql5.com
Language Basics / Preprocessor / Program Properties (#property) - Documentation on MQL5
 

MQL string type is in Unicode format. So you may have a try to use "FindWindowW" instead of "FindWindowA".

However, I didn't try it :)

 
beachfan:

My code is:

-------------------------------------------------------------------------- 

<CODE DELETED>

-------------------------------------------------------------------------- 

Compiling and running are correct,but the result is:

Receive window Calculator is not found!

 RcvWndHdl=0

 ---------------------------------------------------------------------------

My purpose is that send data to external window of other program.

In future when you post code please use the   SRC   button: How to use the   SRC   button. 
 
beachfan:


Please post your question for mql4 programming on MQL4 Forum.
MQL4: automated trading forum
  • www.mql5.com
MQL4: automated trading forum
Reason: