From: sawer on
Hi

I just tried to add view new views into another view if possible.

OnInitialUpdate:

CRect clientRect;
GetClientRect(&clientRect);
clientRect.SetRect(clientRect.right -110, clientRect.top+10,
clientRect.right-10, clientRect.top +110);
m_View.Create(NULL, L"View", WS_CHILDWINDOW | WS_VISIBLE,
clientRect,this,61245);
m_View.ShowWindow(SW_SHOW)

It shows a Edit View which is embedded to view but when i close it gives
run-time error. Why is that runtime error occur?

Thanks..
From: Joseph M. Newcomer on
Since a view-within-a-view is not a supported concept, why are you trying to do this?

You already have a view. I don't see why you need to create a CEditView inside it.

And there is no such thing as "a runtime error". There is a VERY SPECIFIC MESSAGE,
reports VERY SPECIFIC STATE. If it is an ASSERT failure, of course, you would enter the
debugger, examine the line of code involved, and tell us where it is and what it is doing.
You would tell us which version of VS you are using. If it is an access fault, you would
tell us that, and where it occurred, and what the stack backtrace is. You would tell us
if you are doing MDI or SDI. You would actually TELL us something that would allow some
guesses as to what is wrong.

But I think your whole problem is you are doing something that doesn't make sense. Stop
doing it and your problem will go away.

Instead of asking how to fix something that shouldn't be done, why not explain what you
are trying to accomplish? Then we could probably tell you the right way to accomplish
this.

Views live inside MDI or SDI frames. They do not live inside other views.

This question can be summarized as "I'm doing something unsupported, and it isn't working,
please tell me why".. The answer is inherent in the first part of the question, but since
you did not tell us ANYTHING about what "a runtime error" is, there is zero chance of
figuring out what went wrong.
joe

On Fri, 23 May 2008 22:50:00 -0700, sawer <sawer(a)discussions.microsoft.com> wrote:

>Hi
>
>I just tried to add view new views into another view if possible.
>
>OnInitialUpdate:
>
> CRect clientRect;
> GetClientRect(&clientRect);
> clientRect.SetRect(clientRect.right -110, clientRect.top+10,
>clientRect.right-10, clientRect.top +110);
> m_View.Create(NULL, L"View", WS_CHILDWINDOW | WS_VISIBLE,
>clientRect,this,61245);
> m_View.ShowWindow(SW_SHOW)
>
>It shows a Edit View which is embedded to view but when i close it gives
>run-time error. Why is that runtime error occur?
>
>Thanks..
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Ajay Kalra on

"sawer" <sawer(a)discussions.microsoft.com> wrote in message
news:3657DAAD-5ABA-4B76-B795-88C39E6BFB45(a)microsoft.com...
> Hi
>
> I just tried to add view new views into another view if possible.
>
> OnInitialUpdate:
>
> CRect clientRect;
> GetClientRect(&clientRect);
> clientRect.SetRect(clientRect.right -110, clientRect.top+10,
> clientRect.right-10, clientRect.top +110);
> m_View.Create(NULL, L"View", WS_CHILDWINDOW | WS_VISIBLE,
> clientRect,this,61245);
> m_View.ShowWindow(SW_SHOW)
>
> It shows a Edit View which is embedded to view but when i close it gives
> run-time error. Why is that runtime error occur?


You shouldnt do this, although you can do it. If you really want to do this
for whatever reason, use IWebBrowser2 instead of CHTMLView. But really your
view should be CHTMLView and not CEditView and it will be created for you.

---
Ajay