Discussion:
WebBrowser and WM_NCHITTEST
(too old to reply)
chris_prog
2007-09-07 21:04:25 UTC
Permalink
Hello Everyone!

First of all: Sorry if I'm not posting in the right group.

I have an MFC Application, in it I have a window (CWnd) on which I
create a CHtmlView-derived object (Paul DiLascia's CHtmlCtrl). As you
most probably know, this control has a WebBrowser control inside it.

What I'd like to achieve is to let the user move the window wherever
in the client or nonclient area he/she starts to drag it. I know how
to make this work with normal CWnds: Handle WM_NCHITTEST message with
CWnd::OnNcHitTest and simply return HTCAPTION.

This approach does not work with the WebBrowser. I know how to work
with WM_LBUTTONDOWN or similar messages (using PreTranslateMessage),
but WM_NCHITTEST is not received in that function.

I've tried to read around on the Net in the subject, the closest I
found is something about DISPATCH_MAP. But this sounds very
complicated to me as I never done anything with interfaces (Advising
and Unadvising, cookies in this subject and such). Could anyone show
any simpler/other solution? Or if there's no other solution, could
anyone show me detailed instructions for this solution in my case?

I'm filling the WebBrowser with my own HTML code, only some text and
some links. So please keep in mind that users need to be able to click
the links.

Thank you in advance!
Chris.
Ajay Kalra
2007-09-13 23:49:44 UTC
Permalink
You will probably need to subclass the inner most window. See if this helps:

http://msdn.microsoft.com/msdnmag/issues/01/09/c/default.aspx

---
Ajay
Post by chris_prog
Hello Everyone!
First of all: Sorry if I'm not posting in the right group.
I have an MFC Application, in it I have a window (CWnd) on which I
create a CHtmlView-derived object (Paul DiLascia's CHtmlCtrl). As you
most probably know, this control has a WebBrowser control inside it.
What I'd like to achieve is to let the user move the window wherever
in the client or nonclient area he/she starts to drag it. I know how
to make this work with normal CWnds: Handle WM_NCHITTEST message with
CWnd::OnNcHitTest and simply return HTCAPTION.
This approach does not work with the WebBrowser. I know how to work
with WM_LBUTTONDOWN or similar messages (using PreTranslateMessage),
but WM_NCHITTEST is not received in that function.
I've tried to read around on the Net in the subject, the closest I
found is something about DISPATCH_MAP. But this sounds very
complicated to me as I never done anything with interfaces (Advising
and Unadvising, cookies in this subject and such). Could anyone show
any simpler/other solution? Or if there's no other solution, could
anyone show me detailed instructions for this solution in my case?
I'm filling the WebBrowser with my own HTML code, only some text and
some links. So please keep in mind that users need to be able to click
the links.
Thank you in advance!
Chris.
Loading...