I am trying to pass messages between various windows. At first I was trying to use
FindWindow() to obtain the handles of various windows, but my results always came
up as 0. So I decided to try just getting the handle of the calling window through
GetActiveWindow(). Again, the result is 0. Why is this not working? Script code
posted below:
int errorcatch = 0;
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int result;
result = GetActiveWindow();
errorcatch = MessageBox("The result is: " + result);
//----
return(0);
}
//+------------------------------------------------------------------+
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
//+------------------------------------------------------------------+
//| SendWinMessage. mq4 |
//| Copyright © 2007, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net/"
#include <WinUser32.mqh>
#import "WinUser32"
int GetActiveWindow();
#import
int errorcatch = 0;
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int result;
result = GetActiveWindow();
errorcatch = MessageBox("The result is: " + result);
//----
return(0);
}
//+------------------------------------------------------------------+
BW