You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i need to custom a ui for special chart,the program i wrote as following:
1.mql script
#import "MyChartDLL.dll"
void CreateUI(int hwin);
#import
int winHandle=WindowHandle("USDCADf",PERIOD_H1);
int winHandle=WindowHandle("Lljr",PERIOD_H1);
if(winHandle==0){
Alert("(Lljr Script Error:#8001) An error occurred while initializing script.");
return;
}
//hTerminal = GetAncestor(WindowHandle(Symbol(), Period()), 2);
Print("winHandle=",winHandle);
CreateUI(winHandle);
2.vc++ code
void CreateUI(int hwin){
HWND handle=(HWND) hwin;
hWinChart=handle;
CWnd* win=CWnd::FromHandle(handle);
CView *pNewView=NULL;
pNewView=new CFView();
CCreateContext context;
BOOL rtVal= pNewView->Create(_T("CFView"),_T("CFView"),WS_CHILD | WS_VISIBLE | WS_MAXIMIZE,CFrameWnd::rectDefault,
win, IDD_FORMCHARTUI);
pNewView->OnInitialUpdate();
pNewView->ShowWindow(SW_SHOW); //显示新的视图
pNewView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
if(rtVal){ MessageBox(NULL,_T("it is ok!"),_T("Information"), 0); } else{ MessageBox(NULL,_T("it is failure!"),_T("Information"), 0); }
}
the result come with an error,and no ui was showed:
2015.03.27 11:28:37.960 Access violation read to 0xDDDDDF6D in 'C:\Users\Administrator\AppData\Roaming\MetaQuotes\Terminal\FF6486332E05B65B7E995E1DD5B90FBE\MQL4\Libraries\MyChartDLL.dll'