Click here to Skip to main content
15,915,172 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Stopping a video when any key is pressed Pin
29-Apr-02 5:29
suss29-Apr-02 5:29 
GeneralRe: Stopping a video when any key is pressed Pin
Mike Nordell29-Apr-02 13:48
Mike Nordell29-Apr-02 13:48 
QuestionHow to setup a button on Visual C++ to execute a pgm Pin
Learning28-Apr-02 10:12
Learning28-Apr-02 10:12 
AnswerRe: How to setup a button on Visual C++ to execute a pgm Pin
Christian Graus28-Apr-02 10:29
protectorChristian Graus28-Apr-02 10:29 
AnswerRe: How to setup a button on Visual C++ to execute a pgm Pin
Nish Nishant28-Apr-02 14:11
sitebuilderNish Nishant28-Apr-02 14:11 
AnswerRe: How to setup a button on Visual C++ to execute a pgm Pin
Maxwell Chen28-Apr-02 19:05
Maxwell Chen28-Apr-02 19:05 
AnswerRe: How to setup a button on Visual C++ to execute a pgm Pin
Gaurika Wijeratne28-Apr-02 19:52
Gaurika Wijeratne28-Apr-02 19:52 
GeneralCFrameWnd - Changing layout Pin
Patrik Mueller28-Apr-02 9:14
Patrik Mueller28-Apr-02 9:14 
Hi everybody,

I'm trying to change the frame layout dynamically. But I always get

ASSERT_VALID fails with illegal vtable pointer.
ASSERT_VALID fails with illegal vtable pointer.
HEAP[CADSplitterTest.exe]: Invalid allocation size - C02740D0 (exceeded 7ffdefff)
Warning: Uncaught exception in WindowProc (returning -1).
Warning: Window creation failed: GetLastError returns 0x00000578
Warning: couldn't create client pane for splitter.

by the second call trying a CreateView.

Here's my actual code:

BOOL Im_FrameWnd::SetViewLayout(ViewArrangement NewLayout, CCreateContext* ActContext)
{
if ((NewLayout != m_ViewLayout) || (m_Initialize))
{
if (ActContext == NULL)
{
ActContext = &m_Context;
}
if (!m_Initialize)
m_MainSplitter.DestroyWindow();
int HalfWidth, HalfHeight, ThirdWidth, ThirdHeight;
HalfWidth = HalfHeight = ThirdWidth = ThirdHeight = 10;
switch (NewLayout)
{
case TWOVIEWSVERT:
{
m_MainSplitter.CreateStatic(this,1,2, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);
m_MainSplitter.SetColumnInfo(0, HalfWidth, 10);
m_MainSplitter.SetColumnInfo(1, HalfWidth, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
break;
case TWOVIEWSHOR:
{
m_MainSplitter.CreateStatic(this,2,1, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);
m_MainSplitter.SetRowInfo(0, HalfHeight, 10);
m_MainSplitter.SetRowInfo(1, HalfHeight, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
break;
/* case THREEVIEWSTWOLEFT:
SplitColumn(myRect.Width()/2);
DeleteView(0,0);
BuildChildSplitter(2,TRUE);
/*
m_HelpSplitter1 = new CSplitterWnd();
m_HelpSplitter1->Create(this,1,2, CSize(10,10), NULL,WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST+10);

CreateView(0,0, NULL);
break;
case THREEVIEWSTWORIGHT:
break;
case THREEVIEWSTWOTOP:
break;
case THREEVIEWSTWOBOTTOM:
break;
*/ case FOURVIEWS:
{
m_MainSplitter.CreateStatic(this,2,2, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);

m_MainSplitter.SetColumnInfo(0, HalfWidth, 10);
m_MainSplitter.SetColumnInfo(1, HalfWidth, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
/* m_MainSplitter.SetRowInfo(0, HalfHeight, 10);
m_MainSplitter.SetRowInfo(1, HalfHeight, 10);
*/
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);

}
break;

/* case FOURVIEWSTHREELEFT:
break;
case FOURVIEWSTHREERIGHT:
break;
case FOURVIEWSTHREETOP:
break;
case FOURVIEWSTHREEBOTTOM:
break;
*/
default:
{
DWORD TempStyle = WS_CHILD|WS_VISIBLE|WS_BORDER|SPLS_DYNAMIC_SPLIT;
m_MainSplitter.Create(this,2,2, CSize(10,10), ActContext, TempStyle, AFX_IDW_PANE_FIRST);
if (!m_Initialize)
{
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
}
break;
}
m_ViewLayout = NewLayout;
RecalcLayout();
}
if (m_Initialize)
m_Initialize = FALSE;
return (TRUE);
}

BOOL Im_FrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_Context.m_pNewViewClass = pContext->m_pNewViewClass;
m_Context.m_pCurrentDoc = pContext->m_pCurrentDoc;
m_Context.m_pNewDocTemplate= pContext->m_pNewDocTemplate;
m_Context.m_pLastView=NULL;
m_Context.m_pCurrentFrame=this;
m_ViewClass = pContext->m_pNewViewClass;
return SetViewLayout(m_ViewLayout, pContext);
}

Since this is my first trial with CSplitterWnd I don't find the error exactly (I'm afraid it's
my CRuntime Class - but I'm not sure.
Studying the examples brings no help because they only create the layout at generation.

Best regards,

Patrik Müller
GeneralRe: CFrameWnd - Changing layout Pin
Patrik Mueller29-Apr-02 1:25
Patrik Mueller29-Apr-02 1:25 
GeneralAPI: replacing chars Pin
User 665828-Apr-02 8:43
User 665828-Apr-02 8:43 
GeneralRe: API: replacing chars Pin
Tom Archer28-Apr-02 9:10
Tom Archer28-Apr-02 9:10 
GeneralRe: API: replacing chars Pin
User 665828-Apr-02 9:16
User 665828-Apr-02 9:16 
GeneralRe: API: replacing chars Pin
Tom Archer28-Apr-02 9:24
Tom Archer28-Apr-02 9:24 
GeneralRe: API: replacing chars Pin
Joaquín M López Muñoz28-Apr-02 9:16
Joaquín M López Muñoz28-Apr-02 9:16 
GeneralRe: API: replacing chars Pin
User 665828-Apr-02 9:28
User 665828-Apr-02 9:28 
GeneralRe: API: replacing chars Pin
Joaquín M López Muñoz28-Apr-02 11:33
Joaquín M López Muñoz28-Apr-02 11:33 
GeneralRe: API: replacing chars Pin
Nish Nishant28-Apr-02 14:13
sitebuilderNish Nishant28-Apr-02 14:13 
GeneralRe: API: replacing chars Pin
Mike Nordell1-May-02 10:19
Mike Nordell1-May-02 10:19 
GeneralCListView & Appending Items :: MFC Pin
valikac28-Apr-02 7:41
valikac28-Apr-02 7:41 
GeneralRe: CListView & Appending Items :: MFC Pin
l a u r e n28-Apr-02 12:30
l a u r e n28-Apr-02 12:30 
GeneralRe: CListView & Appending Items :: MFC Pin
Shog928-Apr-02 12:41
sitebuilderShog928-Apr-02 12:41 
GeneralRe: CListView & Appending Items :: MFC Pin
Ravi Bhavnani28-Apr-02 13:01
professionalRavi Bhavnani28-Apr-02 13:01 
GeneralRe: CListView & Appending Items :: MFC Pin
valikac28-Apr-02 13:13
valikac28-Apr-02 13:13 
GeneralRe: Solution Pin
valikac28-Apr-02 13:14
valikac28-Apr-02 13:14 
QuestionNew class in dialog program? Pin
28-Apr-02 7:40
suss28-Apr-02 7:40 

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.