Click here to Skip to main content
16,012,468 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multithreading Pin
Ryan Binns24-Jul-03 15:05
Ryan Binns24-Jul-03 15:05 
GeneralRe: Multithreading Pin
Anonymous24-Jul-03 15:51
Anonymous24-Jul-03 15:51 
GeneralEdit box focus problem.. Pin
IrishSonic24-Jul-03 12:34
IrishSonic24-Jul-03 12:34 
GeneralRe: Edit box focus problem.. Pin
Ryan Binns24-Jul-03 15:08
Ryan Binns24-Jul-03 15:08 
GeneralRe: Edit box focus problem.. Pin
David Crow25-Jul-03 2:38
David Crow25-Jul-03 2:38 
QuestionBook? Pin
Tom Archer24-Jul-03 12:25
Tom Archer24-Jul-03 12:25 
AnswerRe: Book? Pin
Beer2624-Jul-03 15:52
Beer2624-Jul-03 15:52 
GeneralAccess violation only in release build with debug info Pin
s_k24-Jul-03 10:54
s_k24-Jul-03 10:54 
Hi,
I've SDI application with this code in CMainFrame::OnCreate() (only snippet)

__m_wndDiscBar1.CreateEx(this, TBSTYLE_WRAPABLE|TBSTYLE_FLAT | TBSTYLE_TOOLTIPS |TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_TOOLTIPS|CBRS_SIZE_DYNAMIC,CRect(0,0,0,0));
__m_wndDiscBar1.type=1;
__m_wndDiscBar1.Update(false);
__m_wndDiscBar1.SetFont(getFontLW());

__m_wndDiscBar2.CreateEx(this, TBSTYLE_WRAPABLE|TBSTYLE_FLAT | TBSTYLE_TOOLTIPS |TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_SIZE_DYNAMIC,CRect(0,0,0,0));
__m_wndDiscBar2.type=2;
__m_wndDiscBar2.Update(false);
__m_wndDiscBar2.SetFont(getFontLW());

__m_wndDoubleDiscBar.Create(this,0);
__m_wndDoubleDiscBar.ModifyStyle(0,CBRS_ALIGN_LEFT);
__m_wndDoubleDiscBar.AddBar(&m_wndDiscBar2,NULL,NULL,RBBS_NOGRIPPER|RBBS_FIXEDS
IZE);

__m_wndDoubleDiscBar.AddBar(&m_wndDiscBar1,NULL,NULL,RBBS_NOGRIPPER|RBBS_FIXEDS
IZE);


m_wndDiscBar1/2 are classes derived from CToolBar. m_wndDoubleDiscBar is CReBar instance.

Problem is in this function, which is called from CMyView::OnSize() (I have two CListViews divided by splitter)


CMainFrame::ChangeDlgBar(int cx, int dx)
{
__CReBarCtrl& RCtrl = m_wndDoubleDiscBar.GetReBarCtrl();
__REBARBANDINFO rb;
__rb.cbSize=sizeof(REBARBANDINFO);
__// THIS IS PROBLEM FUNCTION
__RCtrl.GetBandInfo(0,&rb);
__rb.cx=width;
__rb.wID=0;
__rb.fMask=RBBIM_SIZE|RBBIM_ID;
__rb.fStyle=RBBS_FIXEDSIZE|RBBS_NOGRIPPER;
__RCtrl.SetBandInfo(0,&rb);
__RCtrl.MinimizeBand(0);
.
.
}


Here is call stack:
KERNEL32! 77ec8d34()
KERNEL32! 77ec88f9()
COMCTL32! 77b9e2d5()
USER32! 77e3a244()
USER32! 77e16b21()
USER32! 77e16b44()
CWnd:efWindowProcA(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 1053, unsigned int 1, long 1239272) line 1006 + 19 bytes
CWnd::WindowProc(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 1053, unsigned int 1, long 1239272) line 1586 + 19 bytes
CControlBar::WindowProc(CControlBar * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 1053, unsigned int 1, long 1239272) line 480 + 14 bytes
CReBar::WindowProc(CReBar * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 1053, unsigned int 1, long 1239272) line 321 + 14 bytes
AfxCallWndProc(CWnd * 0x00000000 {CWnd hWnd=???}, HWND__ * 0x00230560, unsigned int 1053, unsigned int 1, long 1239272) line 218
AfxWndProc(HWND__ * 0x00230560, unsigned int 1053, unsigned int 1, long 1239272) line 368
USER32! 77e3a244()
USER32! 77e16362()
USER32! 77e168a4()
CReBarCtrl::GetBandInfo() line 157 + 38 bytes
CMainFrame::ChangeDlgBar(int 0, int 1) line 858
CHinfoFileView2::OnSize(unsigned int 0, int 397, int 391) line 384
CWnd::OnWndMsg(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 5, unsigned int 0, long 6260016, long * 0x0012eac4) line 1964
CWnd::WindowProc(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 5, unsigned int 0, long 25624973) line 1585 + 27 bytes
AfxCallWndProc(CWnd * 0x00000000 {CWnd hWnd=???}, HWND__ * 0x003d042e, unsigned int 5, unsigned int 0, long 25624973) line 218
AfxWndProc(HWND__ * 0x003d042e, unsigned int 5, unsigned int 0, long 25624973) line 368
USER32! 77e3a244()
USER32! 77e16362()
USER32! 77e14c1a()
USER32! 77e1dd30()
USER32! 77e3a244()
USER32! 77e16b21()
USER32! 77e16b44()
CWnd:efWindowProcA(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 71, unsigned int 0, long 1240824) line 1006 + 19 bytes
CWnd::WindowProc(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 71, unsigned int 0, long 1240824) line 1586 + 19 bytes
AfxCallWndProc(CWnd * 0x00000000 {CWnd hWnd=???}, HWND__ * 0x003d042e, unsigned int 71, unsigned int 0, long 1240824) line 218
AfxWndProc(HWND__ * 0x003d042e, unsigned int 71, unsigned int 0, long 1240824) line 368
USER32! 77e3a244()
USER32! 77e14730()
USER32! 77e174b4()
NTDLL! 77f91a7f()
COMCTL32! 77b59ddf()
COMCTL32! 77b55af5()
COMCTL32! 77b5b24d()
USER32! 77e3a244()
USER32! 77e16b21()
USER32! 77e16b44()
CWnd:efWindowProcA(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 11, unsigned int 1, long 0) line 1006 + 19 bytes
CWnd::WindowProc(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 11, unsigned int 1, long 0) line 1586 + 19 bytes
AfxCallWndProc(CWnd * 0x00000000 {CWnd hWnd=???}, HWND__ * 0x003d042e, unsigned int 11, unsigned int 1, long 0) line 218
AfxWndProc(HWND__ * 0x003d042e, unsigned int 11, unsigned int 1, long 0) line 368
USER32! 77e3a244()
USER32! 77e16362()
USER32! 77e168a4()
CWnd::SetRedraw() line 120 + 33 bytes
CHinfoFTPDoc::listFiles(CListCtrl * 0x11136980 {CHinfoFileView2 hWnd=0x003d042e}, const char * 0x00000000, int 0, CMyFileView * 0x11136980 {CHinfoFileView2 hWnd=0x003d042e}, int 0) line 993
CHinfoFileView2::OnInitialUpdate() line 259
CWnd::OnWndMsg(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 868, unsigned int 0, long 6320368, long * 0x0012fbc8) line 1825
CWnd::WindowProc(CWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 868, unsigned int 0, long 0) line 1585 + 27 bytes
AfxCallWndProc(CWnd * 0x00000000 {CWnd hWnd=???}, HWND__ * 0x003d042e, unsigned int 868, unsigned int 0, long 0) line 218
CWnd::SendMessageToDescendants(HWND__ * 0x004d052e, unsigned int 868, unsigned int 0, long 0, int 1, int 1) line 2309
CWnd::SendMessageToDescendants(HWND__ * 0x0027045e, unsigned int 868, unsigned int 0, long 0, int 1, int 1) line 2318 + 21 bytes
CFrameWnd::InitialUpdateFrame(CFrameWnd * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), CDocument * 0x1113fdc8 {CHinfoFTPDoc}, int 1) line 753
CDocTemplate::InitialUpdateFrame(CDocTemplate * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), CFrameWnd * 0x11181188 {CMainFrame hWnd=0x0027045e}, CDocument * 0x1113fdc8 {CHinfoFTPDoc}, int 1) line 332
CSingleDocTemplate::OpenDocumentFile(CSingleDocTem
plate * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), const char * 0x00000000, int 1) line 205
CDocManager::OnFileNew(CDocManager * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int)) line 829
_AfxDispatchCmdMsg(CCmdTarget * 0x00640cf8 class CHinfoFTPApp theApp, unsigned int 57600, int 0, void (void)* 0x005b7670 CWinApp::OnFileNew(void), void * 0x00000000, unsigned int 12, AFX_CMDHANDLERINFO * 0x00000000) line 88
CCmdTarget::OnCmdMsg(CCmdTarget * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), unsigned int 57600, int 0, void * 0x00000000, AFX_CMDHANDLERINFO * 0x00000000) line 302 + 24 bytes
CWinApp::ProcessShellCommand(CWinApp * const 0x004700a0 CHinfoFileView2::OnSize(unsigned int, int, int), CCommandLineInfo & {CCommandLineInfo}) line 31 + 23 bytes
CHinfoFTPApp::InitInstance() line 377 + 12 bytes
AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00133feb, int 1) line 39 + 7 bytes
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00133feb, int 1) line 30
HINFOFTP! WinMainCRTStartup + 224 bytes
KERNEL32! 77ea847c()
[/php]
I went deeper for the cause of the access violation and found possible problem in this code:

LRESULT CALLBACK AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
__// special message which identifies the window as using AfxWndProc
__if (nMsg == WM_QUERYAFXWNDPROC)
____return 1;
__// all other messages route through message map
__CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
__ASSERT(pWnd != NULL);
__ASSERT(pWnd->m_hWnd == hWnd);
__return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
}

because CWnd::FromHandlePermanent(hWnd) returns NULL. But hWnd is valid (or at least the same value as I could see imediately after CReBar::Create() being finished)

But what's most confusing for me - this access violation only appears when I build release build with debug info (For Edit And Continue). When I build release build without debug info or when I build debug info, no access violation happens.

I'm really out....

Could someone help me?

I will appreciate any suggestion.
GeneralRe: Access violation only in release build with debug info Pin
AlexO24-Jul-03 11:37
AlexO24-Jul-03 11:37 
GeneralRe: Access violation only in release build with debug info Pin
s_k24-Jul-03 11:44
s_k24-Jul-03 11:44 
GeneralRe: Access violation only in release build with debug info Pin
AlexO25-Jul-03 3:47
AlexO25-Jul-03 3:47 
GeneralRe: Access violation only in release build with debug info Pin
s_k25-Jul-03 3:52
s_k25-Jul-03 3:52 
GeneralRe: Access violation only in release build with debug info Pin
AlexO25-Jul-03 4:04
AlexO25-Jul-03 4:04 
GeneralRe: Access violation only in release build with debug info Pin
s_k25-Jul-03 4:07
s_k25-Jul-03 4:07 
GeneralRe: Access violation only in release build with debug info Pin
Neville Franks24-Jul-03 11:47
Neville Franks24-Jul-03 11:47 
GeneralRe: Access violation only in release build with debug info Pin
s_k24-Jul-03 11:51
s_k24-Jul-03 11:51 
GeneralRe: Access violation only in release build with debug info Pin
Neville Franks24-Jul-03 12:11
Neville Franks24-Jul-03 12:11 
GeneralRe: Access violation only in release build with debug info Pin
Anthony_Yio24-Jul-03 16:38
Anthony_Yio24-Jul-03 16:38 
QuestionWhy does my Dialog app exit when enter key is pressed? Pin
Terry O'Nolley24-Jul-03 10:50
Terry O'Nolley24-Jul-03 10:50 
AnswerRe: Why does my Dialog app exit when enter key is pressed? Pin
John M. Drescher24-Jul-03 10:52
John M. Drescher24-Jul-03 10:52 
GeneralRe: Why does my Dialog app exit when enter key is pressed? Pin
Terry O'Nolley24-Jul-03 11:02
Terry O'Nolley24-Jul-03 11:02 
GeneralRe: Why does my Dialog app exit when enter key is pressed? Pin
Toni7824-Jul-03 12:28
Toni7824-Jul-03 12:28 
AnswerRe: Why does my Dialog app exit when enter key is pressed? Pin
Michael Dunn24-Jul-03 12:35
sitebuilderMichael Dunn24-Jul-03 12:35 
GeneralDisplaying images on a CDialog Pin
Tom Archer24-Jul-03 10:42
Tom Archer24-Jul-03 10:42 
GeneralRe: Displaying images on a CDialog Pin
Terry O'Nolley24-Jul-03 10:58
Terry O'Nolley24-Jul-03 10:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.