Try to compile ...
#import "user32.dll" int GetParent(long hWnd); #import
Use long as the hWnd data type,
ChartGetInteger() returns long type not int.
You´re right, this seemed to be my mistake. Thank you, overlooked this.
But you cannot replace "int" by "long", the parameter must be casted.
#import "user32.dll" int GetParent(int hWnd); #import #define __MT_HWNDCHART (user32::GetParent((int)__MT_HWND)) #define __CHARTID (::ChartID()) #define __MT_HWND (::ChartGetInteger(__CHARTID,CHART_WINDOW_HANDLE)) int OnInit() { //--- This will compile int hwnd=__MT_HWNDCHART; //--- This will compile int hwnd2=user32::GetParent((int)__MT_HWND); //--- This will compile int hwnd3=user32::GetParent(0); return(INIT_SUCCEEDED); }
Try to compile ...
#ifdef __MQL4__ #define HWND int #else #define HWND long #endif #import "user32.dll" HWND GetParent(HWND hWnd); #import #define __MT_HWNDCHART (user32::GetParent(__MT_HWND)) #define __CHARTID (::ChartID()) #define __MT_HWND (::ChartGetInteger(__CHARTID,CHART_WINDOW_HANDLE)) //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- This will produce warning - possible loss of data due to type conversion HWND hwnd=__MT_HWNDCHART; //--- This will produce warning - possible loss of data due to type conversion HWND hwnd2=user32::GetParent(__MT_HWND); //--- This will compile HWND hwnd3=user32::GetParent(0); }
Are you sure that HWND is 64bit when "winuser32.dll" is called from MT5? I use plenty of windows function and have all types the same within MT4 and MT5 and everything works without problems. A function like GetParent() has only one parameter, which is not a problem cause its just the stack size that changes, but what happens when you call function that takes 2 or more parameters?
Are you sure that HWND is 64bit when "winuser32.dll" is called from MT5? I use plenty of windows function and have all types the same within MT4 and MT5 and everything works without problems. A function like GetParent() has only one parameter, which is not a problem cause its just the stack size that changes, but what happens when you call function that takes 2 or more parameters?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Try to compile ...