Omer
Omer

Reputation: 661

Problem with SetCapture and IWebBrowser2 container

I have an OLE object of IWebBrowser2 wrapped in a window.

At some point I expand the window and its OLE object and I'd like it to collapse on external click (i.e. every click that is outside the web browser).

I use SetCapture on the window wrapper but from some reason, during the capture, the Webbrowser doesn't receive any mouse events (clicks,move etc...)

Any thoughts\ideas?

Thanks,
Omer

Upvotes: 0

Views: 410

Answers (1)

Heinrich Ulbricht
Heinrich Ulbricht

Reputation: 10362

Cite from SetCapture:

Sets the mouse capture to the specified window belonging to the current thread. SetCapture captures mouse input either when the mouse is over the capturing window, or when the mouse button was pressed while the mouse was over the capturing window and the button is still down. Only one window at a time can capture the mouse.

So you cannot use SetCapture on a window to actually capture clicks. It specifically for the case where the user clicks your window and moves the mouse out, while keeping the button pressed. So you will have to use another mechanism.

Upvotes: 1

Related Questions