I am creating a view in my project which is a child class of CView.
class CBaseGLView : public CView
In oncreate function I am checking it null or not as below:
int CBaseGLView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
m_hWnd = GetSafeHwnd();
if( ::IsWindow(m_hWnd)== NULL)
{
return 1;
}
m_pCDC= new CClientDC(this);
m_hDC = m_pCDC->GetSafeHdc();
if (SetWindowPixelFormat()==FALSE)
return 0;
return 0;
}
When I am debugging with ApplicationVerifier I am getting a debug assertion in below lines in afxwin2.inl:
_AFXWIN_INLINE LRESULT CWnd::_AFX_FUNCNAME(SendMessage)(UINT message, WPARAM wParam, LPARAM lParam) const
{ ASSERT(::IsWindow(m_hWnd)); return ::SendMessage(m_hWnd, message, wParam, lParam); }
And also m_hwnd
is shown as unused 0
with the memory address of 0x00170fd6
.
Given below is the output from Application verifier.
VERIFIER STOP 00000013: pid 0xDF4: First chance access violation for current stack trace.
339F9020 : Invalid address causing the exception.
0109D75E : Code address executing the invalid access.
0018E034 : Exception record.
0018E084 : Context record.
Following is the call stack of the debug build. It is too long, sorry for that.
ntdll.dll!7729000c()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
vrfcore.dll!VfCoreRedirectedStopMessage(unsigned long Code=19, char * Message=0x73341b5c, unsigned long Param1=444756000, char * Description1=0x73341b94, unsigned long Param2=17422174, char * Description2=0x73341bb4, unsigned long Param3=1630260, char * Description3=0x73341bd4, unsigned long Param4=1630340, char * Description4=0x73341c00) Line 103 + 0x19 bytes C++
vfbasics.dll!VerifierStopMessage(unsigned long Code=19, char * Message=0x73341b5c, unsigned long Param1=444756000, char * Description1=0x73341b94, unsigned long Param2=17422174, char * Description2=0x73341bb4, unsigned long Param3=1630260, char * Description3=0x73341bd4, unsigned long Param4=1630340, char * Description4=0x73341c00) Line 1214 C
vfbasics.dll!AVrfpCheckFirstChanceException(_EXCEPTION_POINTERS * ExceptionPointers=0x0018df7c) Line 1108 + 0x2b bytes C
vfbasics.dll!AVrfpVectoredExceptionHandler(_EXCEPTION_POINTERS * ExceptionPointers=0x0018df7c) Line 323 C
ntdll.dll!772f62de()
ntdll.dll!772db652()
ntdll.dll!772db314()
ntdll.dll!77290133()
user32.dll!753a617a()
Axial.exe!CWnd::SendMessageA(unsigned int message=2125, unsigned int wParam=0, long lParam=0) Line 42 + 0x44 bytes C++
Axial.exe!SECWorkbookClientWnd::OnMDISetMenu(unsigned int wParam=261688291, long lParam=21302363) Line 390 C++
Axial.exe!CWnd::OnWndMsg(unsigned int message=560, unsigned int wParam=261688291, long lParam=21302363, long * pResult=0x0018e980) Line 2018 + 0x11 bytes C++
Axial.exe!CWnd::WindowProc(unsigned int message=560, unsigned int wParam=261688291, long lParam=21302363) Line 1755 + 0x20 bytes C++
Axial.exe!AfxCallWndProc(CWnd * pWnd=0x1a54bf98, HWND__ * hWnd=0x00120ff0, unsigned int nMsg=560, unsigned int wParam=261688291, long lParam=21302363) Line 240 + 0x1c bytes C++
Axial.exe!AfxWndProc(HWND__ * hWnd=0x00120ff0, unsigned int nMsg=560, unsigned int wParam=261688291, long lParam=21302363) Line 403 C++
user32.dll!753962fa()
user32.dll!75397316()
user32.dll!75396ce9()
user32.dll!75396de8()
user32.dll!75396e44()
ntdll.dll!7729010a()
user32.dll!753972b9()
user32.dll!753a2161()
user32.dll!753a0f91()
user32.dll!753a9deb()
user32.dll!753a9dfd()
user32.dll!753a8124()
Axial.exe!CMDIChildWnd::DefWindowProcA(unsigned int nMsg=34, unsigned int wParam=0, long lParam=0) Line 429 C++
Axial.exe!CWnd::WindowProc(unsigned int message=34, unsigned int wParam=0, long lParam=0) Line 1756 + 0x1c bytes C++
Axial.exe!AfxCallWndProc(CWnd * pWnd=0x1a826f08, HWND__ * hWnd=0x00210bbe, unsigned int nMsg=34, unsigned int wParam=0, long lParam=0) Line 240 + 0x1c bytes C++
Axial.exe!AfxWndProc(HWND__ * hWnd=0x00210bbe, unsigned int nMsg=34, unsigned int wParam=0, long lParam=0) Line 403 C++
user32.dll!753962fa()
user32.dll!75396d3a()
user32.dll!75396ce9()
user32.dll!75396de8()
user32.dll!75396e44()
ntdll.dll!7729010a()
user32.dll!75398e63()
user32.dll!753a7b51()
Axial.exe!CFrameWnd::BringToTop(int nCmdShow=1) Line 2362 C++
Axial.exe!CFrameWnd::ActivateFrame(int nCmdShow=1) Line 2341 C++
Axial.exe!CMDIChildWnd::ActivateFrame(int nCmdShow=-1) Line 762 C++
Axial.exe!CFrameWnd::InitialUpdateFrame(CDocument * pDoc=0x1a6a2de8, int bMakeVisible=1) Line 814 C++
Axial.exe!CDocTemplate::InitialUpdateFrame(CFrameWnd * pFrame=0x1a826f08, CDocument * pDoc=0x1a6a2de8, int bMakeVisible=1) Line 330 C++
Axial.exe!CMultiDocTemplate::OpenDocumentFile(const char * lpszPathName=0x0018f6fc, int bMakeVisible=1) Line 166 C++
Axial.exe!CDocManager::OpenDocumentFile(const char * lpszFileName=0x19418fa0) Line 986 C++
Axial.exe!CWinApp::OpenDocumentFile(const char * lpszFileName=0x19418fa0) Line 84 C++
Axial.exe!CAxialApp::OpenDocumentFile(const char * lpszFileName=0x19418fa0) Line 983 + 0xc bytes C++
Axial.exe!CWinApp::OnOpenRecentFile(unsigned int nID=57616) Line 132 + 0x2a bytes C++
Axial.exe!_AfxDispatchCmdMsg(CCmdTarget * pTarget=0x018e6e88, unsigned int nID=57616, int nCode=0, void (void)* pfn=0x009f8140, void * pExtra=0x00000000, unsigned int nSig=60, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 101 + 0xa bytes C++
Axial.exe!CCmdTarget::OnCmdMsg(unsigned int nID=57616, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 381 + 0x27 bytes C++
Axial.exe!CAxialApp::OnCmdMsg(unsigned int id=57616, int code=0, void * extra=0x00000000, AFX_CMDHANDLERINFO * handler=0x00000000) Line 1135 + 0x40 bytes C++
Axial.exe!CFrameWnd::OnCmdMsg(unsigned int nID=57616, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 951 + 0x23 bytes C++
Axial.exe!SECMDIFrameWnd::OnCmdMsg(unsigned int nID=57616, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 2270 C++
Axial.exe!CWnd::OnCommand(unsigned int wParam=57616, long lParam=0) Line 2364 C++
Axial.exe!CFrameWnd::OnCommand(unsigned int wParam=57616, long lParam=0) Line 366 C++
Axial.exe!SECMDIFrameWnd::OnCommand(unsigned int wParam=57616, long lParam=0) Line 2214 + 0x10 bytes C++
Axial.exe!CWnd::OnWndMsg(unsigned int message=273, unsigned int wParam=57616, long lParam=0, long * pResult=0x0018fc68) Line 1769 + 0x1e bytes C++
Axial.exe!CWnd::WindowProc(unsigned int message=273, unsigned int wParam=57616, long lParam=0) Line 1755 + 0x20 bytes C++
Axial.exe!SECMDIFrameWnd::WindowProc(unsigned int message=273, unsigned int wParam=57616, long lParam=0) Line 2685 + 0x14 bytes C++
Axial.exe!AfxCallWndProc(CWnd * pWnd=0x1a4acf78, HWND__ * hWnd=0x0005102a, unsigned int nMsg=273, unsigned int wParam=57616, long lParam=0) Line 240 + 0x1c bytes C++
Axial.exe!AfxWndProc(HWND__ * hWnd=0x0005102a, unsigned int nMsg=273, unsigned int wParam=57616, long lParam=0) Line 403 C++
user32.dll!753962fa()
user32.dll!75396d3a()
user32.dll!75396ce9()
user32.dll!753977c4()
user32.dll!75397bca()
Axial.exe!AfxInternalPumpMessage() Line 183 C++
Axial.exe!CWinThread::PumpMessage() Line 900 C++
Axial.exe!CWinThread::Run() Line 629 + 0xd bytes C++
Axial.exe!CWinApp::Run() Line 896 C++
Axial.exe!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x07e78ffd, int nCmdShow=1) Line 47 + 0xd bytes C++
Axial.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x07e78ffd, int nCmdShow=1) Line 34 C++
Axial.exe!__tmainCRTStartup() Line 263 + 0x2c bytes C
Axial.exe!WinMainCRTStartup() Line 182 C
kernel32.dll!768033aa()
ntdll.dll!772b9ef2()
ntdll.dll!772b9ec5()
Your help is greately appreciated. Thanks.