public int TranslateAccelerator(MSG msg, ref Guid group, int nCmdID) { //illustrates how to trap and cancel an accelerator command // Debug.WriteLine("Translate Accel"); if (nCmdID == commandids.IDM_PASTE) { BeforePasteArgs e = new BeforePasteArgs(); container.OnBeforePaste(e); if (e.Cancel) { return(HRESULT.S_OK); //cancel the paste } } return(HRESULT.S_FALSE); }