views:

45

answers:

0

I'm writing an office ActiveX control in c#. I'm testing in Microsoft Word 2007, I have a very simple control:

[Guid("186A1449-CF7C-42f1-8E3C-8E1BF7D0376B")]
public interface AxWeb
{
}

[Guid("101CB6AF-AEC4-4e54-86B9-427F2437D907")]
[ClassInterface(ClassInterfaceType.None)]
public partial class Web : UserControl, AxWeb
{
    [EditorBrowsable(EditorBrowsableState.Never)]
    [ComRegisterFunction]
    public static void Register(Type t)
    {
        ActiveXCtrlHelper.RegasmRegisterControl(t);
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    [ComUnregisterFunction]
    public static void Unregister(Type t)
    {
        ActiveXCtrlHelper.RegasmUnregisterControl(t);
    }

    protected override void DefWndProc(ref Message m)
    {
        Debug.WriteLine(m);
        base.DefWndProc(ref m);
    }

    public Web()
    {
        InitializeComponent();
    }
}

If I drop this onto a word document and uncheck design mode, no problems. If I resize it smaller then uncheck design mode, it starts shrinking, like it keeps reapplying the size difference. I've been tracing out the window messages and there are a lot of these:

msg=0x46 (WM_WINDOWPOSCHANGING) hwnd=0x30c5e wparam=0x0 lparam=0x3feb1c result=0x0
msg=0x83 (WM_NCCALCSIZE) hwnd=0x30c5e wparam=0x1 lparam=0x3feaf4 result=0x0
msg=0x47 (WM_WINDOWPOSCHANGED) hwnd=0x30c5e wparam=0x0 lparam=0x3feb1c result=0x0
msg=0x5 (WM_SIZE) hwnd=0x30c5e wparam=0x0 lparam=0x290035 result=0x0

But i'm not sure how to proceed. It doesn't happen in Excel either. Any help or pointers would be very appreciated!