Form loses focus when focus is inside embedded window

dpaul007 used Ask the Experts™
I have a form in which I have opened a Word document via the picturebox control using the SetParent API

m_hwnd = SetParent(m_hwnd2, Picture1.hWnd)

I have the document formatted how I like it.  However, when I click on the document, the form loses focus.  I have trying the SendMessage Function

SendMessage m_hwnd2, WS_CHILD, 0, 0

But it does not work.  I have also tried replacing the m_hwnd2 with m_hwnd and the form still loses focus.

Am I missing something here?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

This problem and its resolution has been described here:;en-us;289498&

Best regards,


That worked except for the fact that it disabled the Word document so I couldn't use it.  I tried to use the Activate command but to no avail.
Author of the Year 2009

Hi dpaul007,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

dpaul007, Please DO NOT accept THIS comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
DanRollins -- EE database cleanup volunteer
per recommendation

Community Support Moderator @Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial