Hi Hans ,
Thanks for your post.
I am not familiar with Office automation. Normally, ContextMenu.Show()
method internally invokes TrackPopupMenuEx win32 API to do the actual work.
So we may do something like this:
[StructLayout(LayoutKind.Sequential)]
public class TPMPARAMS
{
public int cbSize;
public int rcExclude_left;
public int rcExclude_top;
public int rcExclude_right;
public int rcExclude_bottom;
}
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool TrackPopupMenuEx(IntPtr hmenu, int fuFlags, int
x, int y, IntPtr hwnd, TPMPARAMS tpm);
private void button1_Click(object sender, System.EventArgs e)
{
Point pt=this.PointToScreen(this.textBox1.Location);
TrackPopupMenuEx(this.contextMenu1.Handle, 0x42,
pt.X+10, pt.Y+10, this.textBox1.Handle, null);
}
You can substitute the "this.textBox1.Handle" with your activeX window
handle value. However, I am not sure if this work for Office Addin.
Hope this helps!
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Max - 01 Mar 2006 14:11 GMT
Jeffrey,
Thanks for the suggestion. I have tried it but when I use this technique
with an ActiveX control embedded in Excel all items within submenus are
disabled. Anyway, I have solved it by creating a transparent dummy form and
using this form as parent for the menu.
HAns
> Hi Hans ,
>
[quoted text clipped - 35 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 02 Mar 2006 01:45 GMT
Hi HAns,
I am glad your use the transparent layer to resolve the problem. If you
need further help, please feel free to post. Thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.