在运行时获取断言错误:访问冲突读取位置 [英] At the run time getting Assert Error : Access violation reading location
问题描述
HI
我创建了一个拆分器窗口,并创建了2个视图.一个视图正在正确加载,但另一个视图未加载,在运行时我遇到如下错误:
AccAccess违反读取位置0x00000020.
我在衬砌下的波纹管下遇到此错误
AFX_STATIC无效AFXAPI _AfxDeferClientPos(AFX_SIZEPARENTPARAMS * lpLayout,
CWnd * pWnd,int x,int y,int cx,int cy,BOOL bScrollBar)
{
ASSERT(pWnd!= NULL);
ASSERT(pWnd-> m_hWnd!= NULL); .
我创建视图的代码是这样的.
HI
I have created a splitter window and i have created 2 views. one view is loading properly but another one is not loading, while running i am getting the error like:
AccAccess violation reading location 0x00000020.
This error i am getting at line bellow under lined
AFX_STATIC void AFXAPI _AfxDeferClientPos(AFX_SIZEPARENTPARAMS* lpLayout,
CWnd* pWnd, int x, int y, int cx, int cy, BOOL bScrollBar)
{
ASSERT(pWnd != NULL);
ASSERT(pWnd->m_hWnd != NULL);.
My code for creating views is like this.
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_splitwnd.CreateStatic( this, 1, 2 );
m_splitwnd.CreateView( 0, 0, RUNTIME_CLASS(CFirstView), CSize( 100, 100 ), pContext );
m_splitwnd.CreateView( 0, 1, RUNTIME_CLASS(CSecondView), CSize( 200, 200 ), pContext );
return TRUE;
}
谁能帮我.
在此先感谢
can any one help me.
Thanks In Advance
推荐答案
看看以下代码段:
https://vcpptips.wordpress.com/tag/oncreateclient/ [
Take a look at this snippet:
https://vcpptips.wordpress.com/tag/oncreateclient/[^]
Regards
Espen Harlinn
对我来说,return语句似乎不正确.试试这个:
The return statement seems incorrect to me. Try this:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs,
CCreateContext* pContext)
{
m_splitwnd.CreateStatic( this, 1, 2 );
m_splitwnd.CreateView( 0, 0, RUNTIME_CLASS(CFirstView),
CSize( 100, 100 ), pContext );
m_splitwnd.CreateView( 0, 1, RUNTIME_CLASS(CSecondView),
CSize( 200, 200 ), pContext );
return __super::OnCreateClient(lpcs, pContext);
}
对不起,我在这里添加了文字
sorry by mistakly i added my text here
这篇关于在运行时获取断言错误:访问冲突读取位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!