Collapsing Word Menu

E

Enn

I have got an issue with programatically closing / collapsing the word menu.
Here is what I am doing...

I have a Windows forms based application developed in C#. I have an user
control within the form. I create the Word application object and a word
document. I open a .doc file and get the window handle to the word Document
using PInvoke (FindWindow). I set the user control as the parent window to
the handle I got above. So I am able to see the Word document in the use
control.

Now when I click on any of the menu items (say for example, on File or Edit
or View...), keep the menu open / expanded and click on any other application
running from the task bar and click on my application again - my application
is not getting the focus.

I suspected that the menu opens a new window which has obtained the focus
and when I switch back the menu window has the focus and not my application.

I have tried the following:

1. Tried to subclass (using NativeWindow) the menu (MsoCommandBar and
"MenuBar") using FindWindow. This way I tried to close the menu window by
posting a message. I did not get any messages on menu click. After Googling I
found that it is not possible to subclass an unmanaged window in managed
window.

Can you please help me with the solution?

TIA

Enn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top