public static int SendMessage(Control destinationObject, int messageId, int generic16BitsParameter, int generic32BitsParameter) { if (destinationObject == null) { throw new NolmeArgumentNullException(); } int iResult = User32ApiNativeMethods.SendMessage(new HandleRef(destinationObject, destinationObject.Handle), messageId, generic16BitsParameter, generic32BitsParameter); return(iResult); }
/// <summary> /// Resumes drawing and event handling. /// </summary> /// <remarks> /// This method should be called every time a call is made /// made to BeginUpdate. It resets the event mask to it's /// original value and enables redrawing of the control. /// </remarks> public static void EndUpdate(Control sourceRichEdit) { if (sourceRichEdit == null) { throw new NolmeArgumentNullException(); } // Deal with nested calls --updating; if (updating > 0) { return; } // Allow the control to redraw itself User32ApiNativeMethods.SendMessage(new HandleRef(sourceRichEdit, sourceRichEdit.Handle), WM_SETREDRAW, 1, 0); // Allow the control to raise event messages User32ApiNativeMethods.SendMessage(new HandleRef(sourceRichEdit, sourceRichEdit.Handle), EM_SETEVENTMASK, 0, oldEventMask); }
/// <summary> /// Maintains performance while updating. /// </summary> /// <remarks> /// <para> /// It is recommended to call this method before doing /// any major updates that you do not wish the user to /// see. Remember to call EndUpdate when you are finished /// with the update. Nested calls are supported. /// </para> /// <para> /// Calling this method will prevent redrawing. It will /// also setup the event mask of the underlying richedit /// control so that no events are sent. /// </para> /// </remarks> public static void BeginUpdate(Control sourceRichEdit) { if (sourceRichEdit == null) { throw new NolmeArgumentNullException(); } // Deal with nested calls ++updating; if (updating > 1) { return; } // Prevent the control from raising any events oldEventMask = User32ApiNativeMethods.SendMessage(new HandleRef(sourceRichEdit, sourceRichEdit.Handle), EM_SETEVENTMASK, 0, 0); // Prevent the control from redrawing itself User32ApiNativeMethods.SendMessage(new HandleRef(sourceRichEdit, sourceRichEdit.Handle), WM_SETREDRAW, 0, 0); }
public static int SendMessage(IntPtr windowHandle, int messageId, int generic16BitsParameter, object parameter) { int iResult = User32ApiNativeMethods.SendMessage((int)windowHandle, messageId, generic16BitsParameter, (int)parameter); return(iResult); }
public static int SendMessage(HandleRef windowHandle, int messageId, int generic16BitsParameter, int generic32BitsParameter) { int iResult = User32ApiNativeMethods.SendMessage(windowHandle, messageId, generic16BitsParameter, generic32BitsParameter); return(iResult); }