views:

965

answers:

3

I have this modeless MFC dialog which embeds an Internet Explorer web browser control.

The control is derived straight from CWnd with ActiveX wrappers generated by Visual Studio, and I map it to the CDialog using only a "DDX_Control(pDX, IDC_EXPLORER, m_explorer);"

I have 2 problems.

Problem #1:
Being modeless, I start and stop the dialog at my own pleasure using new/Create(), then DestroyWindow()/delete(in PostNcDestroy).

Trouble begins when the IE control starts loading a Flash video (regular YouTube stuff): when one closes, thus destroying the dialog, the video still loads! Right until fully cached. The Flash ActiveX thread still lingers and continues to run even when the parent dialog has passed PostNcDestroy and all memory was freed.

What to do? How do you trully 'kill' that child web control and all its threads?

Problem #2:
The web browser control covers the whole area of the dialog. I cannot intercept any OnMouseMove() - in the parent dialog or in the web browser mapping class! What gives?

Thanks!

A: 

For problem#1, What is your cleanup sequence when destroying the dialog?

Problem#2, Do you meant to say, the control occupies more space than what you've specified while creating?

Prakash
A: 

"Cleanup"

"delete this" in PostNcDestroy() - and calling the base func of course. Should it be more? What? Shouldn't the dialog gracefully take care of its children?

I tried to explicitly call DestroyWindow on the web control, or send/post him messages like WM_DESTROY, WM_CLOSE, even WM_QUIT - but nothing - same deal.

Problem #2:

No, like indented, the control takes all space and it's on top so I guess any mouse action doesn't get transmitted 'bellow' :)? But then why doesn't his own OnMouseMove get called? Because it goes straight from CWnd? I'm lost...

Valentin Galea
+2  A: 

problem 1) try myBrowser.navigate("about:blank") before destroying the window.

rec
Good idea! I'm gonna try it...
Valentin Galea