CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Feb 2005
    Posts
    218

    CToolBarCtrl::AddBitmap() gives me trouble in afxcrit.cpp

    Code:
    m_wndToolBar.Create(this);
    m_wndToolBar.GetToolBarCtrl().AddBitmap(10,IDB_GRIDTB);
    where IDB_GRIDTB is a bitmap resource containing 10 buttons of 16x16. The bitmap is 160x16. I tried to SetBitmapSize() but it didn't help.

    The 'AddBitmap' line gives me the following error:
    Code:
    Unhandled exception at 0x5d0a7f36 in Tester.exe: 0xC0000005: Access violation reading location 0x0383fffc.
    The crash occurs somewhere at the end of this function:
    Code:
    void AFXAPI AfxUnlockGlobals(int nLockType)
    {
    	ASSERT(_afxCriticalInit);
    	ASSERT((UINT)nLockType < CRIT_MAX);
    
    	// unlock specific resource
    	ASSERT(_afxLockInit[nLockType]);
    #ifdef _DEBUG
    	ASSERT(--_afxResourceLocked[nLockType] >= 0);
    #endif
    	LeaveCriticalSection(&_afxResourceLock[nLockType]);
    }
    in afxcrit.cpp that is.

    edit: I also just saw that m_wndToolBar.GetToolBarCtrl().AddBitmap(9,IDR_MAINFRAME); works. Maybe the problem is that my bitmap has 24bit colours?


    timv
    Last edited by timv; September 29th, 2005 at 10:01 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured