// This is new with v6 comctrl on Vista private void ClickSplitButton() { // Make sure that the control is enabled if (!SafeNativeMethods.IsWindowEnabled(_hwnd)) { throw new ElementNotEnabledException(); } WindowsSysHeader parent = _parent as WindowsSysHeader; if (parent != null) { parent.ScrollIntoView(this); } Rect rect = XSendMessage.GetItemRect(_hwnd, NativeMethods.HDM_GETITEMDROPDOWNRECT, _item); NativeMethods.Win32Rect rectW32 = new NativeMethods.Win32Rect(rect); IntPtr center = NativeMethods.Util.MAKELPARAM(rectW32.left + ((rectW32.right - rectW32.left) / 2), rectW32.top + ((rectW32.bottom - rectW32.top) / 2)); // click // This code does not seem to work Misc.ProxySendMessage(_hwnd, NativeMethods.WM_LBUTTONDOWN, new IntPtr(NativeMethods.MK_LBUTTON), center); Misc.ProxySendMessage(_hwnd, NativeMethods.WM_LBUTTONUP, IntPtr.Zero, center); }
// Same as a click on one of the header element void IInvokeProvider.Invoke() { // Make sure that the control is enabled if (!SafeNativeMethods.IsWindowEnabled(_hwnd)) { throw new ElementNotEnabledException(); } WindowsSysHeader parent = _parent as WindowsSysHeader; if (parent != null) { parent.ScrollIntoView(this); } NativeMethods.Win32Point pt; if (!GetInvokationPoint(out pt)) { throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed)); } IntPtr center = NativeMethods.Util.MAKELPARAM(pt.x, pt.y); // click Misc.ProxySendMessage(_hwnd, NativeMethods.WM_LBUTTONDOWN, new IntPtr(NativeMethods.MK_LBUTTON), center); Misc.ProxySendMessage(_hwnd, NativeMethods.WM_LBUTTONUP, IntPtr.Zero, center); }