« Using java resources in J# | Main | Top 10 Programming Peeves of the Year »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c6cc353ef00d83523448453ef

Listed below are links to weblogs that reference Word AddIn WM_INITMENU event:

Comments

Bryan

Hi Dave - Is this source code still available? I am trying to intercept the message pump in Word 2007. I am able to get a handle to main Word window as follows:

MyNativeWindow w = new MyNativeWindow();
IntPtr wordWindow = MyNativeMethods.FindWindow("OpusApp", this.Application.ActiveWindow.Caption + " - Microsoft Word");
w.AssignHandle(wordWindow);

MyNativeWindow is a simple subclass of NativeWindow:

public class MyNativeWindow : System.Windows.Forms.NativeWindow
{
protected override void WndProc(ref System.Windows.Forms.Message m)
{
// Some logging code here to capture messages
base.WndProc(ref m);
}
}

I am successfully getting the handle to the Word app, but I am only getting one WM_PARENTNOTIFY message no matter what I do in Word 2007. I can click around, open documents, etc, but a single WM_PARENTNOTIFY message is sent on start-up.

Any clue what I'm missing here?

Thanks!

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.