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.Code:m_wndToolBar.Create(this); m_wndToolBar.GetToolBarCtrl().AddBitmap(10,IDB_GRIDTB);
The 'AddBitmap' line gives me the following error:The crash occurs somewhere at the end of this function:Code:Unhandled exception at 0x5d0a7f36 in Tester.exe: 0xC0000005: Access violation reading location 0x0383fffc.in afxcrit.cpp that is.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]); }
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




Reply With Quote