Originally posted by: Wenfei Wu
This fixes the crash.
In BOOL CMRCSizeControlBar::Create(),
Modify
m_dwStyle = dwStyle;
to
m_dwStyle = dwStyle & CBRS_ALL;
Originally posted by: Birch Champeon
I have received a number of emails asking how I added grippers to these controls.
here is what I did:
Add a WM_SETCURSOR and WM_PAINT handlers to the sizecont.cpp file.
Then paste this code onto the bottom of the sizecont.cpp file.
BOOL CMRCSizeControlBar::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT
message)
{
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
return CControlBar::OnSetCursor(pWnd, nHitTest, message);
}
CRect CMRCSizeControlBar::GetGripperRect()
{
CRect pRect;
GetClientRect(pRect);
pRect.OffsetRect(-pRect.left,-pRect.top);
if(IsHorizontal()) {
pRect.DeflateRect(3,3);
pRect.left += 1;
pRect.right = pRect.left+3;
pRect.bottom -= 3;
pRect.top += 2;
}
else {
pRect.DeflateRect(4,4);
pRect.top += 2;
pRect.bottom = pRect.top+3;
pRect.right -= 2;
pRect.left += 2;
}
return pRect;
}
void CMRCSizeControlBar::OnPaint()
{
CPaintDC dc(this);
// DrawGripper();
if(!IsProbablyFloating())
{
CDC *pDC = GetDC();
// draw the gripper.
CRect pRect(GetGripperRect());
pDC->Draw3dRect( pRect, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNSHADOW) );
if(IsHorizontal())
pRect.OffsetRect(4,0);
else
pRect.OffsetRect(0,4);
pDC->Draw3dRect( pRect, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNSHADOW) );
ReleaseDC(pDC);
}
}
This code was taken from Kirk Stowell's code on the page:
http://www.codeguru.com/docking/devstudio_like_controlbar3.shtml
You might have to play around with this a little but this is basically
all I did.
hope this helps,
Birch
ReplyOriginally posted by: Walter
Hi:
Can I use this DLL with Visual Basic 5.0?
Regards
Walter
Originally posted by: Mahadasa Venu
Could you please help me in getting the appropriate solution to this.
Regards
Venu.
Problem in extracting the MRXEXT50.zip. I have been trying to download and unzip the above said file many times. But, failed to extract the zip file.
Originally posted by: Gary Whitehead
My app was crashing under VC6.0 until I rebuilt it with changed project settings: "use MFC in a shared DLL" and not "use MFC in a static library". (under Projects / Settings / General)
Originally posted by: Sundaresan Raman
I finally got this after trying myself for several hours.
ReplyOriginally posted by: Eugene Polonsky
1) Apply WangJun's fix, but not only to the place he indicated. Apply it also to the following function
(and probably any other function that's got a Create method defined:)
//-----------------------------------------------------------------------------
dwStyle &= ~CBRS_ALL;
// If there a list of bitmap id's, then let the user configure the toolbar
// initialize common controls
// save the style,Please Add the follow line here
return TRUE;
Basically the fix is to insert "SetBarStyle(dwStyle & CBRS_ALL) right before you call the
CWnd::Create method. For the curious of you, the reason that this crash occurs in the first place, is that
Microsoft, in their infinite wisdom, decided to insert additional checking in the create method, in
particular, asserting that the dwStyle long contains only MFC-defined flags, and not any user-defined flags.
VC5 did not do this, that's why it doesn't crash. If you go to Search in the VC6.0 IDE, and type in CBRS_ALL,
the only link that comes up is where they mention this additional checking.
Now, when I applied those fixes, I got a different crash. (Duh) In this case, it was something in
winfrm2.cpp, whatever that is. Anyway, that's fixed by commenting out the following lines, like so:
EnableDocking(CBRS_ALIGN_ANY);
in the CMainFrame's OnCreate method. (this is in Docktest project, dockDemo worked fine.) I'm not sure why
this works, I just know it worked. :)
-- Gene
Ok. I've finally managed to make MRCEXT (which is absolutely great, btw, CJ doesn't work nearly as well) to
work with VC6.0, SP3, debug mode. Here's how I did it.
BOOL CMRCSizeToolBar::Create(CWnd * pParent, DWORD dwStyle, UINT nID, LPRECT pRect)
//-----------------------------------------------------------------------------
{
// if no rectangle supplied, then what is hopefully as sensible default.
// ie a single row of buttons
CRect rect;
if (pRect != NULL)
rect.CopyRect(pRect);
else
{
pParent->GetClientRect(&rect);
rect.left = 0;
rect.top = 0;
rect.bottom = m_sizeImage.cy + 18;
rect.right -= 8;
}
// the rectangle specifies the default floating size.
m_FloatSize = rect.Size();
m_HorzDockSize = m_FloatSize;
m_VertDockSize.cy = m_HorzDockSize.cx;
m_VertDockSize.cx = m_HorzDockSize.cy;
// save the style
m_dwStyle = dwStyle;
if (nID == AFX_IDW_TOOLBAR)
m_dwStyle |= CBRS_HIDE_INPLACE;
dwStyle |= CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE
| TBSTYLE_WRAPABLE;
if (m_pBitmapIds != NULL)
dwStyle |= CCS_ADJUSTABLE;
InitCommonControls();
//1998.11.12 Wangjun
SetBarStyle(dwStyle & CBRS_ALL);
// create the HWND
if (!CWnd::Create(TOOLBARCLASSNAME, NULL, dwStyle, rect, pParent, nID))
return FALSE;
}
// m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
// DockControlBar(&m_wndToolBar);
m_wndFixedToolBar.EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndFixedToolBar);
Originally posted by: G.Stalin
I want to make this Resizable-Docking window as an ActiveX control. I need to reuse the same control in many
of my projects.
Is that possible? Can someone help me out?
Originally posted by: Anand G
I'm not sure if it is related to the dockable windows'.... but in the Dockdemo sample there is a noticeable flicker in the tab control when we change between tabs.....any idea why and how do we eliminate it....
ReplyOriginally posted by: Tim Hein
Not entirely sure how I did it, but I re-downloaded the mrcext50.zip file, unzipped, and did a rebuild all
for the debug version of the mrcext project with VC 6.0. Copied the .lib and .dll files over to my other
project directory. Removed all the old references to the MRCEXT/VC 4.0 version (lib, and header files) and
added references to the new MRCEXT/VC 5.0/6.0 version. Did a rebuild all on my app and the debug
assertion/crash went away.